隐藏 UITabBarControllers 选项卡
我正在为我的应用程序开发一项新功能。 我想提交错误修复更新(与新功能无关),因此我需要隐藏 1 选项卡。 有没有办法在代码中执行此操作,以便我可以轻松隐藏选项卡并在需要时将其恢复?
更新: 这就是我所做的
NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray:self.tabBarController.viewControllers];
[viewControllers removeObjectAtIndex:1]; //remove the tab you don't need...
[self.tabBarController setViewControllers:viewControllers];
[viewControllers release];
I am working on a new feature for my app.
I want to submit a bug fix update (unrelated to the new feature) and so I need to just hide the 1 tab.
Is there a way to do this in code so that I can easily hide the tab and bring it back when needed?
UPDATE:
Here's what I did
NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray:self.tabBarController.viewControllers];
[viewControllers removeObjectAtIndex:1]; //remove the tab you don't need...
[self.tabBarController setViewControllers:viewControllers];
[viewControllers release];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 UITabBarController 的 viewControllers 属性设置为不包含您想要隐藏的选项卡,然后再次将其设置为包含该选项卡应该可以解决问题。
Setting the
viewControllers
property of your UITabBarController to not include the tab you'd like to hide, then setting it again to include that tab should do the trick.