ios - View Controller 上缺少导航栏

标签 ios xcode uinavigationcontroller

我在 Xcode 中使用导航栏, 我添加了导航栏,但在我的 View 中没有显示:

我的 Storyboard

enter image description here

但是我对模拟器的看法

enter image description here

还有我的配置

enter image description here

我做错了什么??

最佳答案

Simulated Metrics 部分中的值仅影响您在 Interface Builder 中看到的内容;它们在运行时完全被忽略。您没有看到导航栏,因为您可能没有将 View Controller 推送到导航 Controller 实例 (UINavigationController.pushViewController(_:animated:))。巧合的是,您在认为导航栏应该出现的地方看到了一个空白区域,因为您已经在 Storyboard 中的“Presione...”行上方指定了那么多垂直空白区域。

请注意,您不必手动将 View Controller 推送到导航 Controller 中,因为您已将其指定为 Storyboard中导航 Controller 的 rootViewController。显示您的导航 Controller ,它会自动推送 Root View Controller 。

关于ios - View Controller 上缺少导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44593211/

相关文章:

ios - CoreData 可转换 : Custom Transformer never gets called - NSKeyedArchiver is used instead

xcode - 存储 boolean 值以供 Parse 登录访问

iphone - 如何在两个不同的 View Controller 之间传递信息?

ios - 可以调用 UIKit PushViewController :animated: cause eventual stack overflows (or other anomalies)?

ios - xmpp iOS : How to retrieve all registered users from openfire Server

ios - 应用程序不断要求输入密码以使用 'Local Items' 钥匙串(keychain)

iphone - 如何检查用户是否清除了iPhone后台应用程序的运行状态?

ios - 使用 PrivateFrameworkHeader-iOS-iPhone-5 API

ios - ICViewPager 顶部和底部有奇怪的空格

uinavigationcontroller - 带有自动布局的 iOS7 View 在 TabBar 上方排列