I am using a third party library called SideMenu, which can be found here. It works like a charm, but in my app, I use a white status bar UIStatusBarStyle.lightContent
. I set this up in the entire project: in the deployment info and programmatically:
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
In viewDidLoad()
, I also call setNeedsStatusBarAppearanceUpdate()
. It works on all ViewControllers, except when I use the SideMenu. When it appears, the text of the StatusBar becomes black and when I close it, it doesn't turn white again. It only becomes white when I go to another ViewController where the preferredStatusBarStyle
is overridden.
Any ideas on how I can fix this? Do I need to call setNeedsStatusBarAppearanceUpdate()
somewhere else? I have tried to look at the source code of SideMenu and tried to implement it in the transition function, but this was unsuccessful as well.
Note: I have set up my project with .lightContent
in the deployment info, but still my ViewControllers show black status bar if I don't override the preferredStatusBarStyle
. Maybe this can be the issue as well - it is by default not white but black, even though I set it to .lightContent
?
EDIT: I also use these extensions to make the color of the StatusBar work using TabBarController and NavigationController. Issue could be in here as well:
extension UITabBarController {
open override var childForStatusBarStyle: UIViewController? {
return selectedViewController
}
}
extension UINavigationController {
open override var childForStatusBarStyle: UIViewController? {
return visibleViewController
}
}