Hackmodford
Hackmodford

Reputation: 3970

Hide a UITabBarControllers Tab

I am working on a new feature for my app. I want to submit a bug fix update (unrelated to the new feature) and so I need to just hide the 1 tab. Is there a way to do this in code so that I can easily hide the tab and bring it back when needed?

UPDATE: Here's what I did

NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray:self.tabBarController.viewControllers];
[viewControllers removeObjectAtIndex:1]; //remove the tab you don't need...
[self.tabBarController setViewControllers:viewControllers];
[viewControllers release];

Upvotes: 0

Views: 201

Answers (1)

Paul Tiarks
Paul Tiarks

Reputation: 1921

Setting the viewControllers property of your UITabBarController to not include the tab you'd like to hide, then setting it again to include that tab should do the trick.

Upvotes: 1

Related Questions