当前页面隐藏tabbar

来源:互联网 发布:狸窝mac版下载 编辑:程序博客网 时间:2024/05/29 17:57

from: http://www.devdiv.com/home.php?mod=space&uid=45444&do=blog&id=5868


当通过PUSH的时候,可以使用

favori.hidesBottomBarWhenPushed =YES;



否则:


- (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;
}


原创粉丝点击