IOS pushviewcontroller隐藏UITabBar

要在一个tabbar+navbar的页面切换到navbar页面,

 

尝试了多种方式:

1:self.tabBarController.tabBar.hidden=yes, 只是不显示tabbar但是对应的区域不可用

 

2:在push之前修改下一个页面的frame,  把tabbar移到屏幕下边,

 

for (UIView *v in self.tabBarController.view.subviews) {

if ([v isKindOfClass:[UITabBar class]]) {

if (hidden) {

[v setFrame:CGRectMake(v.frame.origin.x, 480, v.frame.size.width, v.frame.size.height)];

}else {

[v setFrame:CGRectMake(v.frame.origin.x, 480-49, v.frame.size.width, v.frame.size.height)];

}

}else {

if (hidden) {

[v setFrame:CGRectMake(v.frame.origin.x, v.frame.origin.y, v.frame.size.width, 480)];

}else {

[v setFrame:CGRectMake(v.frame.origin.x, v.frame.origin.y, v.frame.size.width, 480-49)];

}

}

}

不足之处就是切换的效果有点奇怪
3:在push之前设置要push进去的viewcontroller.hidesbottombarwhenpushed=yes
第三种方式最理想,并且pop出来时也不用做什么事

你可能感兴趣的:(controller)