ios - 无法通过 Interface Builder 将条形按钮添加到第二页

标签 ios iphone interface-builder

我的应用程序有两个页面,所以在界面生成器中我有三个 Controller :

  • 一个导航 Controller
  • 通过 RootViewController 转到 TableViewController1
  • 通过推送到 TableViewController2 进行搜索

我通过从工具中拖动它,轻松地将一个 Bar Button 添加到 TableViewController1 的导航栏的右侧。

尝试在 TableViewController2 中做同样的事情,它不会删除栏按钮。

我在 Navigation Controller 上选中了“Shows Navigation Bar”属性,我可以在 TableViewController2 上看到导航栏的空间,但是我在组件层次结构中看不到相同的“Navigation Item” TableViewController1。

如果我将一个条形按钮拖到 Controller 本身,它会在 Controller 上放置一个新的 NavigationItem 图标(在 First Responder 和 Exit 之间),这看起来很有希望,但是当我运行应用程序时它不会显示。

最佳答案

对于这个 TableViewController2,您必须明确地将导航项添加到 xib 中,然后您可以在其上添加栏按钮项。 enter image description here

在 xib 中是这样的,可以设置标题和按钮。 enter image description here

关于ios - 无法通过 Interface Builder 将条形按钮添加到第二页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27822120/

相关文章:

ios - 在 Interface Builder 中确定 UI 元素的可用运行时属性

iphone - 如何检查 UIImageView 是否出现在 iphone 中的 View 位置

ios - xcode 自动调整 xib 的大小在 iphone 6s plus 上不合适

iphone - 转换前 View 未完全加载?

objective-c - 窗口底部的状态栏,看起来像界面生成器

xcode - cocoa 中 NSTextField 上的 "rich text"按钮的用途是什么?

android - FLEX - ZXing - Android、移动 - 条码读取器

ios - 在 ios 10 中将事件添加到谷歌日历

ios - 如何在没有 Storyboards/Unwindng Segues 的情况下在 Swift 中使用 UIViewControllerAnimatedTransitioning?

iphone - 为什么我的 iPhone 应用程序中的默认 UI 控件变得模糊?