iOS之滑动隐藏导航

滑动隐藏导航狼栏

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGFloat offsetY = scrollView.contentOffset.y + _tableView.contentInset.top;
    CGFloat panTranslationY = [scrollView.panGestureRecognizer translationInView:self.tableView].y;
    if (offsetY > 64) {
        if (panTranslationY > 0) {
            //下滑趋势,显示
            [self.navigationController setNavigationBarHidden:NO animated:YES];
        }else{
            //上滑趋势,隐藏
            [self.navigationController setNavigationBarHidden:YES animated:YES];
        }
    }else{
        [self.navigationController setNavigationBarHidden:NO animated:YES];
    }
}
posted @ 2016-09-26 12:48  YaoJinye  阅读(894)  评论(0编辑  收藏  举报