views:

341

answers:

2

Hi Guys,

I am very new to iPhone and Xcode. I am trying to create a tab-based application, in that from the first page, when a button is clicked, I need to remove/hide some of the tabs added in the tab bar.

Can any one help me out please.

Thanks and Regards, Bala.

+3  A: 

Let's say you want to remove the fourth tab from the tab bar (tab index == 3). Just modify the tabbar controller's viewControllers array accordingly:

NSUInteger indexToRemove = 3;
NSMutableArray *controllersToKeep = [NSMutableArray arrayWithArray:tabBarController.viewControllers];
UIViewController *removedViewController = [[controllersToKeep objectAtIndex:indexToRemove] retain];
[controllersToKeep removeObjectAtIndex:indexToRemove];
[tabBarController setViewControllers:controllersToKeep animated:YES];

Note that if you want to keep the removed/hidden view controller around in the background, it's essential that you retain it before removing it from the tab bar (see line 3).

Ole Begemann
Ohoo Great Thanks It's working fine for me.... Thanks a lot...
bala
Then you should accept the answer.
Ole Begemann
A: 

how i can remove tab bar when press button of video play start fullscreen? i have tab bar in the bottom overlay the video when play....

regards

luca