jazzedge
11/28/2017 - 8:27 PM

Swift - AppDelegate

How to set statusBarStyle and UINavigationBar for all VCs

//See: https://stackoverflow.com/questions/43073623/changing-the-color-of-the-status-bar
Source: BorgGreen

01. First in Plist set View controller-based status bar appearance to NO

02. Add this code to AppDelegate.swift

    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Set Status Bar to light colour for ALL ViewControllers
        //UIApplication.shared.statusBarStyle = .lightContent
        //Set Navigation Bar text to black for ALL ViewControllers
        UINavigationBar.appearance().backgroundColor = UIColor.red
        UINavigationBar.appearance().tintColor = UIColor.black
        return true
    }