ios - 导航栏将 TextView 中的文本向下移动其高度的 2 倍

标签 ios autolayout interface-builder

我正在尝试创建一个简单的 View Controller ,它只包含一个 TextView 。此 View 有一个关联的导航 Controller ,它添加了一个禁用“显示导航栏”的导航栏。 View 的约束是:

  • Text View.top = Top Layout Guide.bottom
  • Text View.bottom = Bottom Layout Guide.top
  • Text View.leading = leadingMargin
  • Text View.trailing = trailingMargin

no navigation bar

只要我在导航 Controller 上启用“显示导航栏”属性, TextView 中的文本就会向下滑动导航栏的高度,而 TextView 则保持原样。

navigation bar enabled, frames not yet updated

在运行“更新框架”以考虑向下移动的布局指南后, TextView 向下移动了导航栏的高度,这使 TextView 中文本的效果加倍。

frames have been updated

我做错了什么或者这是 UIKit 中的错误吗?有简单的解决方法吗?

我使用的是 XCode 7.1 (7B91b) 和 iOS 9.1。

最佳答案

在属性检查器中取消选中 View Controller 的“调整 ScrollView 插入”!

View Controller

关于ios - 导航栏将 TextView 中的文本向下移动其高度的 2 倍,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33485656/

相关文章:

ios - [CustomViewController respondsToSelector :]: message sent to deallocated instance

ios - 使用 http 和 https 移动网络服务

ios - 主视图从 ScrollView 中占用顶部空间?

ios - UIScrollView 将元素定位在屏幕底部,而不是 ScrollView 底部

ios - UIImageView 驻留在视网膜 4"

ios - 将子 UIViewConroller 添加到 UITabBarController

ios - iOS 13 中第二个 View Controller 的导航栏按钮对齐错误

swift - StackView 在所有屏幕尺寸上显示不正确

iphone - 在 iOS 上设计 3 行对话框的方法 - 多语言可用

ios - 每个目标不同的 Storyboard本地化