Alex Rivera | Logout

Iphone: Is it possible to hide the TabBar? (Pre-iOS 8)

Asked 2009-12-30T20:06:33.720
34

I have an application that uses a UITabBarController to switch between modes. When in a certain mode, I'd like to hide the tab bar until the steps of that mode have been completed. Note that I'm not using a navigation controller so I can't use the setHidesBottomBarWhenPushed method on the navigation controller to hide the tab bar.

Prior to iOS 8, When I attempt to hide the tarbar using:

self.tabBarController.tabBar.hidden = YES

the tab bar goes away, but it leaves a 50 pixel blank area at the bottom of the screen where the tab bar used to be. I can't seem to figure out how to fill that area. Anything in the UI that is in that area is clipped and cannot be seen.

Any ideas if this is even possible? I'd really like to stay away from the navigation controller.

Edit
Report

1 Answer

0

The obvious solution, keeping your original architecture, would have been to present that view modally:

- (void)tabBarController:(UITabBarController *)tb
 didSelectViewController:(UIViewController *)vc {
    if (tb.selectedIndex == MODALONE) {
        UIViewController* mod = 
            [[UIViewController alloc] initWithNibName: @"ModalView" 
                                               bundle: nil];
        [tb presentModalViewController:mod animated:NO];
        [mod release];
    }
}

The view now covers the entire screen (except for the status bar is there is one) including the tab bar, so it looks as if the tab bar has gone away in response to the user pressing that tab bar item.

answered 2010-11-01T19:46:15.450

Your Answer