底部导航上拉出现,下拉消失
条件一:全局变量 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);
}];
}
}
}