Reputation: 1738
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() {
super.viewDidLoad()
navigationBar.tintColor = UIColor.themeDarkGray()
navigationBar.barTintColor = UIColor.themeDarkGray()
navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()] // Title's text color
self.title = "Title Here"
}
}
Upvotes: 2
Views: 4034
Reputation: 51
if you set custom NavBar then:
Self.navigationBar.pushItem(UINavigationItem(title: "Title"), animated: true)
Upvotes: 2
Reputation: 3878
Try this:
self.navigationController?.navigationBar.topItem?.title = "Title here"
.
It should work! :)
Upvotes: 12