iPhone + UITabBar

问题描述:

我在我的应用程序中有三个标签栏项目的UITabBar。iPhone + UITabBar

在某些情况下,我想显示所有三个标签栏项目和一些情况下,我想隐藏Tabbar中的第三个标签栏项目。

请帮我

发送setItems:animated:消息到UITabBar。例如:

// 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]; 
+0

如果创建一个NSArray,我该如何修改它(添加/删除它的对象),因为它不可变。 – pratik 2009-11-13 11:00:58

+0

我更新了代码以使用NSMutableArray。 – gerry3 2009-11-13 16:34:55