注:测试过可行


    - (void)hideTabBar {  
        if (self.tabBarController.tabBar.hidden == YES) {  
            return;  
        }  
        UIView *contentView;  
        if ( [[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] )  
            contentView = [self.tabBarController.view.subviews objectAtIndex:1];  
        else  
            contentView = [self.tabBarController.view.subviews objectAtIndex:0];  
        contentView.frame = CGRectMake(contentView.bounds.origin.x,  contentView.bounds.origin.y,  contentView.bounds.size.width, contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height);          
        self.tabBarController.tabBar.hidden = YES;  
          
    }  

    - (void)showTabBar  
      
    {  
        if (self.tabBarController.tabBar.hidden == NO)  
        {  
            return;  
        }  
        UIView *contentView;  
        if ([[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]])  
              
            contentView = [self.tabBarController.view.subviews objectAtIndex:1];  
      
        else  
              
            contentView = [self.tabBarController.view.subviews objectAtIndex:0];        
        contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y,  contentView.bounds.size.width, contentView.bounds.size.height - self.tabBarController.tabBar.frame.size.height);  
        self.tabBarController.tabBar.hidden = NO;  
          
    }  

//如果定义了上面两个方法,在viewDidAppear:方法里面就可以调用了
    -(void)viewDidAppear:(BOOL)animated{  
        //[self hideTabBar];  
        [self showTabBar];  
    }  


参考:http://blog.csdn.net/riveram/article/details/7345577


原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
发表评论
AD
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML 打开UBB 打开表情 隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

 

阅读推荐

服务器相关推荐

开发相关推荐

应用软件推荐