简体   繁体   中英

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?

在此处输入图片说明

And second snapshot is this one:

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM