【问题标题】:How to access the tabbar in a tabbarcontroller?如何访问标签栏控制器中的标签栏?
【发布时间】:2014-02-25 10:13:57
【问题描述】:

我想调用“beginCustomizingItems”方法为用户提供 tabbaritem 管理,就像 iOS 7 音乐应用一样。 所以我读了文档,它说:

你不应该尝试操纵 UITabBar 对象本身 存储在此属性中。如果您尝试这样做,标签栏视图 抛出异常。为标签栏配置项目 界面,您应该分配一个或多个自定义视图 控制器到 viewControllers 属性。标签栏收集 您指定的视图控制器中所需的标签栏项目。**

此属性提供的标签栏视图仅适用于您希望使用 UIActionSheet 类的 showFromTabBar: 方法显示操作表的情况。 不过,我在我的项目中尝试过:

 [self.tabBar beginCustomizingItems:self.tabBar.items];

它崩溃了。但我认为必须有某种方法可以访问标签栏控制器中的标签栏。

有人可以帮我吗?

【问题讨论】:

  • 为什么需要调用 beginCustomizingItems:?

标签: ios uitabbarcontroller tabbar


【解决方案1】:
@property(nonatomic,copy) NSArray *customizableViewControllers; 
// If non-nil, then the "More" view will include an "Edit" button that displays customization UI for the specified controllers. By default, all view controllers are customizable.

最后我发现这对我有帮助。

【讨论】: