iOS7 Navigation bar text colour

My solution was to add the following to AppDelegate:

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];

Swift 3:

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white]

Swift 5:

UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]

In iOS 13 you can set the appearance on a navigation bar itself using UINavigationBarAppearance:

let appearance = UINavigationBarAppearance()
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]

navigationBar.standardAppearance = appearance

To turn your title text color white put this in your viewDidLoad

self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeTextColor : [UIColor whiteColor]}

To change your Status bars text color to white add this to your view

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

Tags:

Iphone

Ios7