0

Since Xcode 11.4 overriding the preferredStatusBarStyle property does not seem to work anymore in some cases.

We have an extension of UINavigationController where we override it for basically every ViewController but this property is no longer called since Xcode 11.4. Therefore the status bar is black for mostly all ViewControllers.

extension UINavigationController {

    override open var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }

}

It also stopped working for some ViewControllers where we override preferredStatusBarStyle again. The property gets accessed, however, the status bar does not change its color.

View controller-based status bar appearance is set to YES in info.plist.

Issue occurs on simulator and real devices.

Does anyone have this problem too?

PatrickDotStar
  • 1,654
  • 1
  • 19
  • 20

2 Answers2

0

change the UIStatusBarStyle in appdelegates in this:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         
        return true
    }
0

Ok I found a solution. Looks like I need to set the barStyle of the navigationBar to .black as described here

navigationController?.navigationBar.barStyle = .black

Not sure though why this is necessary now.

The UINavigationController extension is no longer needed then.

PatrickDotStar
  • 1,654
  • 1
  • 19
  • 20