判断滑动方向UITableView

CGFloat lastContentOffset;  //ScoreView 滑动位置


-(void)scrollViewWillBeginDragging:(UIScrollView*)scrollView{ lastContentOffset = scrollView.contentOffset.y; } -( void )scrollViewDidScroll:( UIScrollView *)scrollView { if (scrollView. contentOffset.y < lastContentOffset ) { //向上,隐藏导航栏 [ self.navigationController setNavigationBarHidden : NO animated : YES ]; } else if (scrollView. contentOffset.y > lastContentOffset ) { //向下 [ self.navigationController setNavigationBarHidden : YES animated : YES ]; } }
原文地址:https://www.cnblogs.com/allanliu/p/4211194.html