Swift 3 UIStatusBarStyle not working for individual ViewControllers in UINavigationController

Something in Swift 3 has changed. I used to be able to change the default status bar color to light on each ViewController, even if it was wrapped inside UINavigationController.

Now I have UINavigationControllerone that controls all of mine UIViewController, and when I do this on each ViewController, it does not work:

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}

On the other hand, when I insert this code into my subclass UINavigationCotroller, it works, but I can’t change it dynamically at all, that is, all of mine ViewControllernow have .lightContent, and I can’t change it.

Is there a solution to this terrifying change?

Thank:)

+4
1

, UIApplication.shared.statusBarStyle = .lightContent AppDelegate.swift didFinishLaunchingWithOptions. info.plist Boolean View controller-based status bar appearance NO.

-1

Source: https://habr.com/ru/post/1655735/


All Articles