// 导航栏隐藏ci
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{it
// NSLog(@"offset---scroll:%f",self.tableView.contentOffset.y);io
//scrollView已经有拖拽手势,直接拿到scrollView的拖拽手势table
UIPanGestureRecognizer* pan = scrollView.panGestureRecognizer;scroll
//获取到拖拽的速度 >0 向下拖动 <0 向上拖动im
CGFloat velocity = [pan velocityInView:scrollView].y;拖拽
if (velocity<-5) {tab
//向上拖动,隐藏导航栏animate
[self.navigationController setNavigationBarHidden:true animated:true];vi
}
else if (velocity>5) {
//向下拖动,显示导航栏
[self.navigationController setNavigationBarHidden:false animated:true];
}
else if(velocity==0){
//中止拖拽
}
}