ios - 在 UINavigationController 上设置 toolbarItems 属性,或者在 UINavigationController 中显示 UIViewController?

标签 ios uiviewcontroller uinavigationcontroller

我想在我的应用程序的每个 View 中显示相同的工具栏项。目前,在推送 View Controller 之前,我将 toolbarItems 属性设置为当前 View Controller 的值。

我可以设置导航 Controller 的 toolbarItems 属性,而不用担心我的各个 View Controller 的 toolbarItems 属性吗?

最佳答案

toolbarItems UINavigationController 的属性对其自己的工具栏没有影响。您应该注意,它是从 UIViewController 继承的,并且仅当您将该导航 Controller 放入另一个导航 Controller 时才有效。

要更新可见的工具栏项目,您应该使用 setToolbarItems:animated:导航 Controller 的顶 View Controller 上的方法。

关于ios - 在 UINavigationController 上设置 toolbarItems 属性,或者在 UINavigationController 中显示 UIViewController?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7855219/

相关文章:

iphone - viewDidLoad 实际上是在每次有 segue 转换时调用的

ios - 在 View Controller 之间保留自定义选项卡栏 View 状态

ios - 正确使用UINavigationController?

ios - Swift SpriteKit-将所有场景音频静音

ios - iOS 8.1 中的 UITextField 在使用某些字体时在编辑模式和非编辑模式之间具有不同的垂直文本对齐方式

iOS 9 更新似乎破坏了 sqlite3

iphone - 关闭呈现的 View Controller

iphone - 当我在 iOS 中返回查看时,导航栏被隐藏

ios - 获取当前 ViewController 的子类 navigationController

ios - Firebase 异步函数,后台队列里有什么不在