When performing some network operations, I present a modal view controller (similar to MBProgressHUD but as a view controller) to prevent user interaction and indicate progress.
The view controller has modalPresentationStyle = .Custom
and is animated using a transitioning delegate and custom presentation controller. Beyond animating the transitions they have no custom actions driving the presentation.
The problem I have is that whenever the view controller is presented, it turns the status bar color black. I could override preferredStatusBarStyle
to make it always return .LightContent
but sometimes this view controller is presented over a view controller with .Default
and I don't want to change it there either. Basically, I want to have the same behavior as UIAlertController
.
I have tried configuring the presentation controller to move the presented view controller out of the status bar space:
private class SEUIProgressControllerPresentationController: UIPresentationController {
override func shouldPresentInFullscreen() -> Bool {
return false
}
private override func frameOfPresentedViewInContainerView() -> CGRect {
return super.frameOfPresentedViewInContainerView().insetBy(dx: 40, dy: 100)
}
...
}
These settings do move the top of the presented controller out of the status bar but the status bar is still affected. Is there a property I am missing that would stop my view controller from updating the status bar style?