PDA

View Full Version : Hide or remove a tab in tab based application in XCode




balanetmail
Dec 11, 2009, 08:16 AM
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 according to clicking of a button i need to remove/hide some of the tab added in the tabbar.
Can any one help me out Plz.

Thanks and Regards,
Bala.



KoolStar
Dec 11, 2009, 10:10 AM
The buttons on the tabbar are stored an an array, all you have to do is remove the button or add a button programmatically to the array in that event action.

balanetmail
Dec 14, 2009, 01:03 AM
Got it and i used the code like...

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

Thanks a lot KoolStar for your replay

Now it is working....

:):):)