【问题标题】:UINavigationController overlapping the ViewController contentUINavigationController 与 ViewController 内容重叠
【发布时间】:2014-11-18 14:46:04
【问题描述】:

在我的应用中,我使用可视化定制的 NavigationController 来处理页面流。

默认情况下,导航栏显示在顶部,视图控制器的内容显示在其下方。但是我想要实现的是视图控制器的实际内容从屏幕顶部开始,而不是在导航栏下方。

所以现在它看起来像(绿色是导航栏):

我希望绿色与 viewController 重叠,我检查了所有导航栏布尔值,但找不到正确的属性。

任何帮助将不胜感激

【问题讨论】:

  • 您的视图控制器是否包含UIScrollView
  • 如果以上正确,请尝试在 ViewController 中自动将AdjustsScrollViewInsets设置为NO。

标签: ios iphone xcode swift


【解决方案1】:

您可能想要检查视图控制器的edgesForExtendedLayout property 的值,并且extendedLayoutIncludesOpaqueBars property 设置为true(因为您的导航栏看起来是不透明的)。假设您使用的是 Swift,可以这样实现:

// This is the default value of edgesForExtendedLayout
controller.edgesForExtendedLayout = .All; 

// The default for this is false
controller.extendedLayoutIncludesOpaqueBars = true;

如果您正在使用该类,您关于 automaticallyAdjustsScrollViewInsets 关于 UIScrollView 的问题也值得研究。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-10
    • 2017-06-16
    • 1970-01-01
    • 1970-01-01
    • 2017-09-10
    • 1970-01-01
    • 2014-04-17
    相关资源
    最近更新 更多