Author Topic: How do I change the color of the title text in a navigation bar?  (Read 2501 times)


  • Administrator
  • *****
  • Posts: 719
    • View Profile
Starting in iOS 7, you can use the new titleTextAttributes property of the navigation bar:

In Swift:

Code: [Select]
let titleDict: NSDictionary = [NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController!.navigationBar.titleTextAttributes = titleDict as [NSObject : AnyObject]

In Objective-C:

Code: [Select]
self.navigationController.navigationBar.titleTextAttributes =
        @{NSForegroundColorAttributeName : [UIColor whiteColor]};

All the best!
Kevin McNeish
Author of "Learn to Code in Swift":
« Last Edit: July 18, 2015, 03:20:39 PM by kjmcneish »