Search code examples
iosuiwebviewstoryboarduitabbar

Black bar shown when UITabBar is hidden on iPhone


I'm purposefully hiding my tab-bar upon viewing a controller consisting of a UIWebView:

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

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

In my storyboard, for this controller, I've set the bottom bar to be "None":

enter image description here

My storyboard shows that the web-view is now taking up all available space at the bottom:

enter image description here

However, I know have a black bar where my tab bar used to be:

enter image description here

Does anyone know why??


Solution

  • Setting hidesBottomBarWhenPushed to YES in viewWillAppear doesn't do anything.

    Set hidesBottomBarWhenPushed to YES before you push to this view controller.

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

    Or in storyboard like this

    enter image description here