UITabbarController:有没有办法切换Tabbar的Tabbar Item(s)

发布于 2024-09-12 08:20:14 字数 390 浏览 0 评论 0原文

情况是,我是一个TabbarViewController,其中包含选项卡{A,B,C,D}。用户单击 Tab:B 后,而不是 Tab {A, B, C, D},我想将 {E, F, G} 显示为选项卡栏上的选项卡栏项。

有没有办法切换Tabbar Item Set? 我是 iOS 新手。谢谢!

编辑: 我也尝试过修改 self.tabbarcontroller.tabbar.items,但出现运行时异常,说 tabbar.items 无法直接修改。

\编辑 找到了解决这种情况的方法:使用导航控制器,并推送一个使用 {A, B, C, D} 的 TabbarView,如果 B 被触摸,则将另一个 TabbarView 推送到导航控制器
@joelm 感谢您的帮助!

问候, 斯特利特

The senario is, I a TabbarViewController, which contains Tab {A, B, C, D}. After User clicked Tab:B, instead Tab {A, B, C, D}, I want show {E, F, G} as the Tabbar item on the Tabbar.

Is there any way to switch Tabbar Item Set?
I'm a newbie to iOS. Thanks!

EDIT:
I've also tried to modify self.tabbarcontroller.tabbar.items, but I got a runtime exception, said that tabbar.items cannot be modified directly.

\EDIT
Found a way to solve this scenario: Use a navigation controller, and push a TabbarView which uses {A, B, C, D}, and if B is touched, push another TabbarView to the navigation controller

@joelm thanks for your help!

Greeting,
Stellit

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

阳光下的泡沫是彩色的 2024-09-19 08:20:14

UITabBarController 维护一个 ViewController 数组,它们对应于用户看到的按钮。您可以更改控制器,但请注意,这将导致 tabBarController 重新加载所有可能不是您想要的控制器。

The UITabBarController maintains an array of ViewControllers which correspond to the buttons the user sees. You can change a controller, but beware that that will cause the tabBarController to reload All the controllers which might not be what you want.

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