Setting NavigationController's NavigationBar translucent property to false causes extra padding

巧了我就是萌 提交于 2019-12-12 06:04:08

问题


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:



来源:https://stackoverflow.com/questions/27710926/setting-navigationcontrollers-navigationbar-translucent-property-to-false-cause

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!