//iOS7时,隐藏tabbar
NSInteger count = self.navigationController.viewControllers.count;
if (count == 1) {
self.tabBarController.tabBar.hidden = NO;
} else {
if (UIDeviceSystemVersion < 8.0) {
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;
}
NSInteger count = self.navigationController.viewControllers.count;
if (count == 1) {
self.tabBarController.tabBar.hidden = NO;
} else {
if (UIDeviceSystemVersion < 8.0) {
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;
}
本文介绍了一种在iOS7环境下,针对不同视图控制器数量动态调整TabBar显示状态的方法。通过判断当前导航控制器中视图控制器的数量来决定是否隐藏TabBar,并针对iOS7系统版本进行了特别适配。
1981

被折叠的 条评论
为什么被折叠?



