iPhone X - Hidden status bar pushes Navigation Bar upwards iPhone X - Hidden status bar pushes Navigation Bar upwards ios ios

iPhone X - Hidden status bar pushes Navigation Bar upwards


One solution is to embed the navigation controller inside a container view controller which is properly constrained to the safe area.

storyboard setup

Just create another view controller and drag a "Container View" from the Object Library. This view has top, bottom, leading, and trailing constraints to the safe area, all with constants equal to 0. If you control-drag from the container view to the navigation controller, you'll get an option to set an "embed segue" which will embed the selected view controller as a child view controller.

I set the status bar to be hidden on the new view controller I created, and it works fine.

screenshot of working layout on iPhone X

This feels like something that UINavigationBar should handle automatically, but this workaround seems like it should work pretty well.

Another note: if you change the color of the navigation bar, you'll also need to create another view above the container view, and change its color to match the color of the navigation bar.


I, for a small app, changed from using a Push to a Modal segue and adding in my own navigation bar. I used Push because it looks good, and already had a Modal for another part, which I wanted to animate differently for style reasons.

For smaller apps this may be the quickest and easiest solution, but my next update I need to use the navigation controller. For that I think I'll switch on the status bar, which is no big deal for me and allows it to work.


I think you need to use "safeAreaLayoutGuide" new update in iOS 11

Apple has provided us with the necessary APIs to get around the unsafe regions of this iphone x. We do this by using the new safeAreaLayoutGuide anchors in our codesafeAreaLayoutGuide