uitableview 无需关联delegate 只需要再uitabviewcontrller 中添加上
UIScrollViewDelegate
int lastContentOffset;
-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
lastContentOffset = scrollView.contentOffset.y;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y<lastContentOffset)
{
[self.navigationControllersetNavigationBarHidden:NOanimated:YES];
//向上
} else if (scrollView.contentOffset.y>lastContentOffset)
{
[self.navigationControllersetNavigationBarHidden:YESanimated:YES];
//向下
}
}