简体   繁体   English

如何设置NavigationBar与iOS11中的ViewController内容重叠

[英]How to set NavigationBar overlapping the ViewController content in iOS11

I want navigationBar to overlap the root view of view controller, I have tried two methods: 我希望navigationBar覆盖视图控制器的根视图,我尝试了两种方法:

self.additionalSafeAreaInsets = UIEdgeInsetsMake(-100, 0, 0, 0);

and

self.edgesForExtendedLayout = UIRectEdgeAll;
self.extendedLayoutIncludesOpaqueBars = YES;

Neither of these options work. 这些选项都不起作用。

So at the moment it looks like the figure below (The gradient orange is the navigationBar) View content below the navigationBar 因此,现在看起来像下面的图(渐变橙色是navigationBar) 查看navigationBar下面的内容

However what I'd like to achieve is that the actual content of the viewController starts at the top of the screen and the gradient orange overlap the viewController. 但是,我想实现的是viewController的实际内容从屏幕顶部开始,渐变橙色与viewController重叠。

If I still can not express it clearly, please tell me. 如果我仍然无法清楚表达,请告诉我。 Thank you. 谢谢。

Not sure what u meant but maybe: 不确定您的意思,但也许:

override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.setNavigationBarHidden(false, animated: false)
}

Or set it visible from the Storyboard 或从情节提要中将其设置为可见 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM