The problem:
Navigation bar is under status bar after playing video in landscape mode.
The application:
- iOS9 only.
- only supports portrait mode.
- the view controller have a web view on it, web view will open a youtube link
- the view controller is embedded in a navigation controller
Setups to reproduce:
- Play a video in a webView,
- Put device into landscape mode.
- Dismiss video play in landscape mode, app goes back to portrait mode
- Navigation bar is in wrong position
Screenshots:
- When app opens
- Play video and put the device in landscape
- The problem:
Best Answer
Swift 3
In the presenting view controller, override the
prefersStatusBarHidden
property to only hide the status bar if it's in landscape.Then add an observer for when the device is rotated.
In the observer's method, call
setNeedsStatusBarAppearanceUpdate
:That should do it.