Why does UINavigationBar change size with notch?

I just want a clear understanding of how UINavigationBar decides to change size on devices with the notch.


I have a child UINavigationController inside a UIViewController that is not full screen, and so it should not adjust for the notch. But no matter what I try, the _UIBarBackground doubles in size to height 88.


I have set automaticallyAdjustsScrollViewInsets = NO; in every parent view controller all the way up to the window.


What exactly is being checked? How can I prevent this?

I've also tried checking the UINavigationBar directly to see what's up. When it appears, its safeAreaInsets are (top = 0, left = 0, bottom = 0, right = 0). The UINavigationController additionalSafeAreaInsets are also (top = 0, left = 0, bottom = 0, right = 0).

So it looks like if UINavigationController.view.frame has an origin of y<notch, it will automatically adjust the UINavigationBar size. Even if it's a child of another view, so it's not at the top of the screen, it still does this.


Again, is there some sort of check? What am I looking for?

Hope I understand exactly your question.


The difference in height may be due to presentation mode: automatic vs fullScreen. Don't think it is linked to insets.


Did you try to set ViewController presentation fo full screen (both in navigationController and in its child views) ?


may also find interest reading this post:

https://stackoverflow.com/questions/58296535/ios-13-new-pagesheet-formsheet-navigationbar-height

and this very detailed one:

h ttps://sarunw.com/posts/uinavigationbar-changes-in-ios13/

Why does UINavigationBar change size with notch?
 
 
Q