ksealey ksealey - 4 months ago 6x
Swift Question

Setting UINavigationController Bar title in Swift 2.0

I am trying to set my navigation bar title but no matter where I set the title it will not show. I have the background color set and that change is applied, just not the title. Please advise.

import UIKit

class CustomNavigationController: UINavigationController{
override func viewDidLoad() {
navigationBar.tintColor = UIColor.themeDarkGray()
navigationBar.barTintColor = UIColor.themeDarkGray()
navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()] // Title's text color
self.title = "Title Here"



Try this:

self.navigationController?.navigationBar.topItem?.title = "Title here".

It should work! :)