How to hide the tabBar when push a view?
Sometimes the hidesBottomBarWhenPushed method hides the bottom bar with a choppy animation.
Instead I hide the tabbar in viewDidLoad with
self.tabBarController.tabBar.hidden = YES;
and restore its presence in viewWillDisappear
self.tabBarController.tabBar.hidden = NO;
use this methood in the UIViewController class where you want to hide the tabBarController
-(BOOL)hidesBottomBarWhenPushed
{
return YES;
}
Update
As suggested by @Yuchen Zhong in his answer, This option is now available in the storyboard itself.
Set UIViewController.hidesBottomBarWhenPushed = YES
when you want hide tab bar.
nextViewController.hidesBottomBarWhenPushed = YES;
You can do this in storyboard now:
- Select the UIViewController in your storyboard
- Select the checkbox Hide Bottom Bar on Push