我有一个链接到4个ViewController的TabBarController,所以标签栏显示4个项目,但我只想显示3个项目。

如何隐藏其他标签栏项目?

我希望标签栏上未显示的ViewController也显示标签栏。

这是故事板:



这是模拟器上的应用程序:



我想隐藏“ Notificaciones”项(这是显示的初始视图)

谢谢!

最佳答案

您可以使用以下代码删除UITabBarItem

NSMutableArray *tabBarViewControllers = [NSMutableArray arrayWithArray:self.tabBarController.viewControllers];
[tabBarViewControllers removeObjectAtIndex:0];
[self.tabBarController setViewControllers: tabBarViewControllers animated:YES];


看起来您现在的设置方式是,一旦选择了其他视图之一,您将无法返回Notificaciones视图,而无需重新加载整个UITabBarViewController。

关于iphone - 在TabBarController中隐藏项目[xcode6/swift],我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28731893/

10-13 04:34