当前位置: 代码迷 >> Iphone >> Iphone掩藏和显示TabBar的方法
  详细解决方案

Iphone掩藏和显示TabBar的方法

热度:124   发布时间:2016-04-25 06:00:29.0
Iphone隐藏和显示TabBar的方法
- (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;    }

?

  相关解决方案