简体   繁体   English

使用情节提要向工具栏添加工具栏按钮项的合适位置在哪里?

[英]Where is the proper place to add a bar button item to a tool bar using storyboard?

I have dropped a UINavigationController onto the story board and added a UIToolbar to it. 我已将UINavigationController放到故事板上,并向其中添加了UIToolbar。 Then using storyboard I attempt to drag and drop a bar button item onto it and set its System Item property to "camera". 然后,我使用情节提要板尝试将条形按钮项拖放到其上,并将其System Item属性设置为“ camera”。 I don't see anything added to the toolbar. 我看不到工具栏上添加任何内容。 UINavigationViewController with Toolbar: 带有工具栏的UINavigationViewController:

在此处输入图片说明

Is this the correct way to add bar button items to a toolbar using Storyboard? 这是使用Storyboard将条形按钮项添加到工具栏的正确方法吗? I want this tool bar to appear on all view controllers attached to this navigation controller. 我希望此工具栏出现在附加到此导航控制器的所有视图控制器上。

Don't add a toolbar to a navigation controller. 不要将工具栏添加到导航控制器。 It already has one. 它已经有一个。 Simply make it visible. 只需使其可见即可。

To add your bar button item, add it to the toolbar shown in the view controller after you mark the toolbar visible for the navigation controller. 要添加条形按钮项,请将其标记为导航控制器可见后,将其添加到视图控制器中显示的工具栏中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM