Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set title of navigation bar

So I have a basic view controller with a navigation bar, this is view controller B, so I'm performing a segue to go here, and I'm trying to change the title like this:

override func viewDidLoad() {
    debugPrint(self.selectedName)
    super.viewDidLoad();
    self.navigationItem.title = "A NEW TITLE"
}

But it doesn't do anything

enter image description here

like image 815
Uffo Avatar asked Jan 20 '17 13:01

Uffo


People also ask

How do I add a title to my navigation bar?

Use navigationBarTitle(_:) to set the title of the navigation bar. This modifier only takes effect when this view is inside of and visible within a NavigationView .

How do I customize my navigation bar?

From Settings, tap Display, and then tap Navigation bar. Make sure Buttons is selected, and then you can choose your desired button setup at the bottom of the screen. Note: This option will also affect the location you swipe when using Swipe gestures.

What is the navigation title?

The navigation title is the label that shows in your site's left-hand navigation menu (and the drop-down navigation, if applicable).


1 Answers

To set Title on NavigationBar simply we can do by below code

self.title = "Your Title"
like image 157
Ganesh Manickam Avatar answered Sep 20 '22 18:09

Ganesh Manickam