UINavigationController how to set title UINavigationController how to set title ios ios

UINavigationController how to set title


In your UIViewController there is a title property and it is that property that will be displayed by the NavigationController. So when pushing a new UIViewController onto the navigation stack set the title of that UIViewController to whatever is appropriate.

In your case it looks like it would be:

[self setTitle:@"WhateverTitle"];


For those looking for a Swift solution:

class CustomViewController: SuperViewController {  override func viewDidLoad() {    super.viewDidLoad()    self.title = "My Custom Title"  }}

The title needs to be set on the UIViewController and not on the UINavigationControllerembedding the view controller.

Documentation: UIViewController Class Reference: title Property


use

self.title = @"yourTitle";


matomo