简体   繁体   中英

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:

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

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.

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 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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