I\'ve been trying to keep UINavigationBar
from moving/resizing when calling setNeedsStatusBarAppearanceUpdate
.
I want to keep the navigatio
You can do this by
I just implemented this solution after numerous failed attempts of fixing the stutter that you get when switching between view controllers where one displays a status bar and another does not. This is the best solution I've found.
I did 1. in a subclass of UINavigationController. I assume this is your best option to stay consistent when walking through a navigation controllers sub view controllers. I did not test the other option though (putting it directly in the sub VC).
Why does this work and why is this the best way to go:
The navigation bar is actually always 44 points high (as commenters already mentioned), but the 20 point status bar pushes it down. Pushing the whole view for this same amount (20) down, ensures the most consistent behavior. Whenever you try to directly manipulate the UINavigationBar, iOS will go to great length to reverse this change.
I had the same problem, and could fix it changing windowLevel to UIWindowLevelStatusBar