views:

765

answers:

1

Hello,

I have a UITabBar in my application with three tab bar items.

At certain cases I want to show all three tab bar items and some cases I want to hide the 3rd tab bar item from the Tabbar.

Please help me

+1  A: 

Send the setItems:animated: message to the UITabBar. For example:

// get array of current UITabBarItem objects
NSMutableArray *tabBarItems = [tabBarViewController.items mutableCopy];

// modify the array (remove or add UITarBarItem objects as appropriate) here

// animate the changes to the UITabBar
[tabBarViewController.tabBar setItems:tabBarItems animiated:YES];
gerry3
If create an NSArray, how can I modify it (add / remove objects from it) because its not mutable.
pratik
I updated the code to use an NSMutableArray.
gerry3