How to hide/show tab bar of a view with a navigation bar in iOS?
I just created a category on UITabBarController that allows you to hide the TabBar, optionally with an animation:
https://github.com/idevsoftware/Cocoa-Touch-Additions/tree/master/UITabBarController_setHidden
It adds the tabBarHidden
property (with isTabBarHidden
as its getter) and the - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated
method.
You can set the UIViewController.hidesBottomBarWhenPushed instead:
DetailViewController *detailViewController = [[DetailViewController alloc] init];
detailViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];
Swift 3:
Set tab bar to hide in viewWillAppear
or viewDidAppear
self.tabBarController?.tabBar.isHidden = true
You can also do this in the Interface Builder for a storyboard. Select the View Controller that you want to hide the Tab Bar for and then select "Hide Bottom Bar on Push".