标签:
条件一:全局变量 CGFloat _scrollviewBeginSet;
CGFloat _scrollviewDidSet;
条件二:代理方法
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView {
_scrollviewBeginSet = scrollView.contentOffset.y;
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
_scrollviewDidSet = 0;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_scrollviewDidSet == 0) {
_scrollviewDidSet = scrollView.contentOffset.y;
if (_scrollviewBeginSet < _scrollviewDidSet) {
[UIView animateWithDuration:.25 animations:^{
barBgView.transform = CGAffineTransformMakeTranslation(0,barBgView.height);
}];
} else {
[UIView animateWithDuration:.25 animations:^{
barBgView.transform = CGAffineTransformMakeTranslation(0,-barBgView.height);
}];
}
}
}
标签:
原文地址:http://www.cnblogs.com/yr434/p/4953669.html