在IB中为什么不能添加多个Bar Button Item?

发布于 2024-08-20 20:32:51 字数 432 浏览 5 评论 0原文

在界面构建器中,创建一个 UIView,然后创建一个 UINavigationBar,然后尝试将多个 UIBarButtomItem 添加到该导航栏。结果层次结构应该是:

- View
  - Navigation Bar
    - Navigation Item (Title)
      - Bar Button Item 
      - Bar Buttom Item

我似乎永远无法添加第二个栏按钮项目。我知道这是可能的,因为 XCode 中的实用程序应用程序模板有它。如果我将该导航栏复制并粘贴到我的 XIB 中,它就可以正常工作。我希望创建一个带有左、右按钮和中间文本的导航栏。

更新

另一个测试是尝试将 Bar Button Item 添加到左侧位置。至少对我来说似乎无法做到这一点。

我在这里缺少什么?

In Interface builder, create a UIView, then a UINavigationBar and then attempt to add multiple UIBarButtomItems to that Navigation Bar. The resulting hierarchy should be:

- View
  - Navigation Bar
    - Navigation Item (Title)
      - Bar Button Item 
      - Bar Buttom Item

I can never seem to add the second Bar Button Item. I know it is possible because the Utility Application Template in XCode has it. If I copy and past that Navigation Bar to my XIB it works fine. I am looking to create a NavigationBar with left, right button and middle text.

UPDATE

Another test is to try and add a Bar Buttom Item to the left position. Can't seem to do it for me at least.

What am I missing here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叹倦 2024-08-27 20:32:51

我在 3.2 beta 2 中执行此操作没有问题。只需确保将其拖动到左侧或右侧即可。放置按钮的位置将出现蓝色轮廓。

编辑:

我已经成功重现了您所说的内容。当我成功完成后,我将项目拖到“漂亮的图片”上,即视图的图形表示。当我尝试将其拖到视图层次结构中时,我遇到了您的问题。您是否尝试过将按钮拖动到实际的导航栏?我希望这一点很清楚,我不太确定如何称呼这个窗口。

I have no problem doing this in 3.2 beta 2. Just make sure to drag it to the left or right side. A blue outline will appear where the button will be placed.

Edit:

I've managed to reproduce what you're talking about. When I did it successfully, I dragged the item to the "pretty picture", the graphical representation of the view. When I tried dragging it into the view hierarchy, I ran into your problem. Have you tried dragging the button to the actual Navigation Bar? I hope this is clear, I'm not really sure what to call this window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文