Select Page

Need to change the navigation bar color? Add this code to the AppDelegate.swift file, within the didFinishLaunchingWithOptions function:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

let navigationBarAppearace = UINavigationBar.appearance()

// Color of Navigation Bar background
navigationBarAppearace.barTintColor = UIColor.white
// Color of Navigation Bar Title
navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.black]
// Color of Navigation Bar back indicator, button titles, button images
navigationBarAppearace.tintColor = UIColor.black

return true
}

This changes colors of the navigation bar for all view controllers.

Written in Swift.