I recently came across a situation where it was useful to have a UITabBar based application, however the actual tab bar was an unnecessary item on the screen. This post is a mini tutorial on how to make this happen.
UPDATE: A few people have asked for the source code, so here is the project.
Inside “application:didFinishLaunchingWithOptions:” method:
tabBarController = [[UITabBarController alloc] init]; tabBarController.viewControllers = [NSArray arrayWithObjects:navController1, viewController1, viewController2, nil]; [window addSubview:tabBarController.view]; [self makeTabBarHidden:TRUE];
Here is the “makeTabBarHidden” method:
-(void)makeTabBarHidden:(BOOL)hide { // Custom code to hide TabBar if ( [tabBarController.view.subviews count] < 2 ) { return; } UIView *contentView; if ( [[tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] ) { contentView = [tabBarController.view.subviews objectAtIndex:1]; } else { contentView = [tabBarController.view.subviews objectAtIndex:0]; } if (hide) { contentView.frame = tabBarController.view.bounds; } else { contentView.frame = CGRectMake(tabBarController.view.bounds.origin.x, tabBarController.view.bounds.origin.y, tabBarController.view.bounds.size.width, tabBarController.view.bounds.size.height - tabBarController.tabBar.frame.size.height); } tabBarController.tabBar.hidden = hide; }
And you are probably wondering how to change the views that are normally controlled by the tab bar? Here is the answer…just simply change the selectedIndex property of the tab bar.
tabBarController.selectedIndex = 1;
The complete source code for the project.
Part of this code came from a post I found on iPhoneDevSDK.com, so I took it one step further and made it a complete solution.


#1 by Colin on May 10th, 2012
Quote
Thank, dude! This was exactly what I was looking for. It works right away.
#2 by landonsandy on May 12th, 2012
Quote
Hey that’s an awesome simple solution, Thanks!
#3 by justin on June 20th, 2012
Quote
it’s really cool! you save my lot time, thanks~
#4 by gaurav on July 18th, 2012
Quote
Thanks man for the great solution..
But i hav one doubt..Do apple vl have any issue with this solution as indirectly we are accessing the internal implementation which is not visible( accessing the subviews of view of tab bar controller) ?? do u know a app which apple have accepted with this piece of code?? I’m waiting for your positive response…Thanks in advance..
#5 by Tushar on August 30th, 2012
Quote
Thank You it help me a lot..
#6 by Keith on September 10th, 2012
Quote
I found this page on Google whilst trying to hide the tab bar myself. This saved me lots of time/frustration, thank you very much for posting this solution!
#7 by Pedro on October 5th, 2012
Quote
Thank you Messi!
#8 by Warrior on November 26th, 2012
Quote
Dude its not working at all and its crashing in iOS 5.0 and later.
I cant see any TabBar.
#9 by Light on February 6th, 2013
Quote
Thanks man