UITabBar隐藏在iPhone上时显示黑条

时间:2016-04-11 17:41:16

标签: ios uiwebview storyboard uitabbar

我在查看由UIWebView组成的控制器时故意隐藏我的标签栏:

- (void)viewWillAppear:(BOOL)animated{
    self.hidesBottomBarWhenPushed = YES;
    self.tabBarController.tabBar.hidden = YES;

    self.url = [NSURL URLWithString:self.urlString];
}

在我的故事板中,对于这个控制器,我将底栏设置为“无”:

enter image description here

我的故事板显示网络视图现在占据了底部的所有可用空间:

enter image description here

但是,我知道我的标签栏曾经是黑色栏:

enter image description here

有谁知道为什么?

1 个答案:

答案 0 :(得分:1)

hidesBottomBarWhenPushed中将YES设置为viewWillAppear并不做任何事情。

在推送到此视图控制器之前,将hidesBottomBarWhenPushed设置为YES

MyViewController *myController = [[MyViewController alloc] init];
//hide tabbar
myController.hidesBottomBarWhenPushed = YES;
//add it to stack.
[[self navigationController] pushViewController:myController animated:YES];

或者像这样的故事板

enter image description here