UIBarButtonItems 未显示在 UIToolbar 上 [英] UIBarButtonItems not showing up on UIToolbar
问题描述
我有一个 UINavigationController,toolbarHidden 设置为 NO.
I have a UINavigationController with toolbarHidden set to NO.
我已将 UIBarButtonItems 添加到 navigationController.toolbar.
I have added UIBarButtonItems to navigationController.toolbar.
工具栏显示了,但按钮不...
The toolbar is displayed, but the buttons are not...
是什么?
推荐答案
好吧,显然我误解了 navigationController 上 setItems 方法的用法.
Ok so apparently I misunderstood the usage of the setItems method on navigationController.
为了解决这个问题,我在推入导航控制器堆栈的每个视图控制器上设置了工具栏项.
To remedy this I set the toolbar items on each view controller that is pushed onto the navigation controller's stack.
我想如果我想让一个工具栏在所有视图中持续存在,我可以向包含导航控制器的视图控制器添加一个新工具栏,然后简单地调用导航控制器上的 setItems.
I guess if I wanted to have one toolbar persist through all the views I could add a new toolbar to the view controller holding my navigation controller then simply invoke setItems on my navigation controller.
我离题了.
这篇关于UIBarButtonItems 未显示在 UIToolbar 上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!