iOS开发 下滑隐藏Tabbar

 项目中用到下滑隐藏tabbar,上滑显示。      虽然实现起来非常简单,还是记录一下。

-(void)scrollViewDidScroll:(UIScrollView*)scrollView

{

    intcurrentPoint=scrollView.contentOffset.y;

    if(currentPoint-preventPoint>20&&currentPoint!=0){

        preventPoint=currentPoint;

        NSLog(@"下滑");

        self.tabBarController.tabBar.hidden=YES;

    }elseif((preventPoint-currentPoint>20)&&(currentPoint  <=scrollView.contentSize.height-scrollView.bounds.size.height-20)){

        preventPoint=currentPoint;

        NSLog(@"上滑");

        self.tabBarController.tabBar.hidden=NO;

    }

}

原文地址:https://www.cnblogs.com/moyunmo/p/3410636.html