Hide the tab bar on certain view controllers

September 30th, 2011

I found it surprisingly tricky to track down how to hide the tabbar on certain view controllers without ending up with a white area where the tabbar would have been. What you need to do is set the tabbar hidden property on the UIViewController you are about to push rather than on the UITabbarController:

UIViewController *hideTabbarViewController = [[UIViewController alloc] init];
hideTabbarViewController.hidesBottomBarWhenPushed = YES;
[[self navigationController] hideTabbarViewController animated:YES];

The best part of the above code is that when you came back from that view controller you don't need to do anything for the tabbar to be added again.

What do you think? Let me know by getting in touch on Twitter - @wibosco