Setting NavigationController's NavigationBar t

2019-09-03 15:18发布

问题:

There appears to be extra padding at the top of the root content view when the translucent = false property is set on the NavigationController's NavigationBar (programatically or via the StoryBoard).

I've tried adjusting the scroll view insets but to no avail. translucent = true doesn't cause this problem.

Any ideas why this is happening and what the easiest way to resolve it is?

回答1:

Ah-ha - got there in the end. When not using a translucent navigation bar you need to ensure that both adjusts scroll view insets and extend edges under opaque bars are set to true on all your view controllers.

Here are the StoryBoard settings: