码迷,mamicode.com
首页 > 其他好文 > 详细

UIScrollView UITableView 上拉隐藏导航栏和tabbar 下拉显示导航栏和tabbar

时间:2015-07-02 19:16:56      阅读:866      评论:0      收藏:0      [点我收藏+]

标签:

//UIScrollView  UITableView 上拉隐藏导航栏和tabbar 下拉显示导航栏和tabbar
-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{

    CGPoint translation = [scrollView.panGestureRecognizer translationInView:scrollView.superview];
    if (translation.y < 0) {
        [UIView animateWithDuration:0.5 animations:^{
            
            self.chatImgTable.frame = CGRectMake(0, -64, ScreenWidth, ScreenHeight+64);
            self.navigationController.navigationBar.frame = CGRectMake(0, -44, ScreenWidth, 44);
            self.tabBarController.tabBar.frame = CGRectMake(0, ScreenHeight, ScreenWidth, 49);
            
        } completion:^(BOOL finished) {
            
            
        }];
        
    } else {
        
        //改变位置
        [UIView animateWithDuration:0.5 animations:^{
            
            self.navigationController.navigationBar.frame = CGRectMake(0, 20, ScreenWidth, 44);
            self.tabBarController.tabBar.frame = CGRectMake(0, ScreenHeight -49, ScreenWidth, 49);
            self.chatImgTable.frame=CGRectMake(0, 0, ScreenWidth, ScreenHeight-49);
        } completion:^(BOOL finished) {
            
        }];
        
    }
    

}

UIScrollView UITableView 上拉隐藏导航栏和tabbar 下拉显示导航栏和tabbar

标签:

原文地址:http://www.cnblogs.com/huangzs/p/4616581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!