简体   繁体   English

iOS-导航栏标题不可见-Swift

[英]iOS - Navigation Bar title not visible - Swift

I am working with Swift and trying to set the title of a navigation controller bar. 我正在使用Swift,并尝试设置导航控制器栏的标题。 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. 但是了解您的ViewController层次结构确实很重要。 So please add more informations in further questions. 因此,请在其他问题中添加更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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