Is there a way how to set the default status bar style while keeping the UIViewControllerBasedStatusBarAppearance
enabled?
Here is the problem, I'm dealing with:
Nearly the whole app needs to be using UIStatusBarStyle.LightContent
as the navigation bar has a dark background. Originally, UIViewControllerBasedStatusBarAppearance
was disabled and the following was set in in Info.plist
for while text status status bar:
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
This worked just fine until I found out that this .LightContent
status bar is shown even for some of the share extensions, like Facebook Messenger, causing it to be unreadable:
This could be solved by using UIViewControllerBasedStatusBarAppearance
, but then I would need to add the following method to all of view controllers which I want to avoid as the app is quite large.
Moreover, for the one screen in the app that has light nav bar background, I was switching to dark nav bar using UIApplication.sharedApplication().setStatusBarStyle()
but this method in deprecated in iOS 9.
Any ideas how to solve this? Swizzling?