Fakhar Zaman
Fakhar Zaman

Reputation: 71

iOS - Navigation Bar title not visible - Swift

I am working with Swift and trying to set the title of a navigation controller bar. I've tried the following code snippets but of no use of all of the following statements.

self.navigationItem.title = "Test "
self.title = "Test "
self.parent?.title = "Test "

I can only see a minor horizontal Line in Nav bar. Here are the attached snippets of nav bar part only. Please look it over and suggest any kind of solution. Why isn't the title appearing in the nav bar?

enter image description here

And second snapshot is this one:

enter image description here

Upvotes: 0

Views: 1033

Answers (1)

BilalReffas
BilalReffas

Reputation: 8328

It should work using following

self.navigationBar.topItem?.title = "Test"

But it's really important to understand your ViewController hierarchy. So please add more informations in further questions.

Upvotes: 1

Related Questions