在没有 UITabBarController 的情况下从 UITabBar 中删除选项卡
我使用的是没有控制器的 UITabBar。如果满足某些条件,我想从 UITabBar 中删除选项卡。例如,我的 UITabBar 在界面生成器中设置了 4 个选项卡。如果在编译时未启用分数模块,则应删除分数选项卡。
// defined in IB
#define kTabScores 1
UITabBar *_tabBar;
// in viewDidLoad
#if !INCLUDE_SCORES_SUPPORT
// this doesn't seem to work
[[_tabBar viewWithTag:kTagScores] removeFromSuperview];
#endif
I'm using a UITabBar without a controller. I want to remove tabs from the UITabBar if certain conditions are met. For example, my UITabBar has 4 tabs set up in interface builder. If the scores module is not enabled at compile time, it should remove the scores tab.
// defined in IB
#define kTabScores 1
UITabBar *_tabBar;
// in viewDidLoad
#if !INCLUDE_SCORES_SUPPORT
// this doesn't seem to work
[[_tabBar viewWithTag:kTagScores] removeFromSuperview];
#endif
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用
UITabBar
?例如:Have you tried using the
items
property of theUITabBar
? For instance: