How would I go about changing the color of the UINavigationBar
in Swift?
Most things online say to do something like:
[self.navigationContro
Use NSForegroundColorAttributeName
as key, not "NSForegroundColorAttributeName"
string.
let titleDict: NSDictionary = [NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController.navigationBar.titleTextAttributes = titleDict
//Nav Bar Title
self.title = "WORK ORDER"
self.navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]
Swift 3
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.white], for: .selected)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName : UIColor.black], for: .normal)
Swift 4.x:
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
Swift 2.0
self.navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]