While presenting a modal view controller - that uses AVFoundation to capture a still image - i chose to hide the status bar as follows:
override prefersStatusBarHidden: Bool {
return true
}The presenting view controller is a regular view controller inside a UINavigationController.
This works beautifully. However, once the modal view controller is dismissed, the status bar starts overlapping the navigation bar on the underlying view controller. Attempts to call setNeedsStatusBarAppearanceUpdate() prove futile. Furthermore, when going back to previous view controllers in the navigation controller stack, all view controllers exhibit the same behavior: the status bar is overlapping the navigation bar, it's as if the navigation bar is unaware the status bar is visible.
This behavior was observed on both iOS 9.x and 8.x, but appears to work just fine in iOS 10. After several tries to resolve the issue, i stumbled upon a workaround that appears to work but feels jenky: Setting the modalPresentationStyle to .overCurrentContext gets the behavior you expect on iOS 9 and 8, but screws up iOS 10 (the status bar is never hidden).
i don't understand why setting the modalPresentationStyle causes it work, and would love to hear an explanation or a cleaner workaround.
- number4