隐藏 UITabBarControllers 选项卡

发布于 2024-12-19 10:58:51 字数 418 浏览 0 评论 0原文

我正在为我的应用程序开发一项新功能。 我想提交错误修复更新(与新功能无关),因此我需要隐藏 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

貪欢 2024-12-26 10:58:51

将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文