[英]Swift storyboard title won't change
I have a VC embedded in a Tab Bar Controller. 我在标签栏控制器中嵌入了VC。 The VC had the title "Profile" set in storyboard, and I changed this to "Menu".
VC在情节提要中设置了标题“个人资料”,我将其更改为“菜单”。 Now, in storyboard, the title shows as "Menu" - but when I run the project, it shows as "Profile".
现在,在情节提要中,标题显示为“菜单”-但是在我运行项目时,标题显示为“配置文件”。 In the storyboard source,
title="Menu"
is set for the VC. 在情节提要源中,为VC设置了
title="Menu"
。
It happens to be the presenting storyboard, so I can change the title in viewWillAppear
and it's resolved, but if I want to use a different storyboard as the presenting storyboard, it'll be an issue I'd rather not work around. 它恰好是演示情节提要,因此我可以在
viewWillAppear
更改标题,并且已解决,但是如果我想使用其他情节提要作为演示情节提要,这将是一个我宁愿解决的问题。
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.title="Menu"
}
Where can I check besides the storyboard's title attribute to make sure this isn't still being set somewhere else, maybe somewhere that only has an effect at runtime. 除了情节提要的title属性,我在哪里可以检查以确保仍未在其他位置设置此属性,也许是在运行时才起作用的位置。 It's not being set in code anywhere
它没有在任何地方的代码中设置
This question was identified as a duplicate of another question. 该问题被认为是另一个问题的重复。 However, my VC is embedded in a Tab Bar Controller, as stated in my first sentence, and I'm already using the code supplied in the answer to the suggested duplicate question in my code example.
但是,正如我的第一句话中所述,我的VC嵌入在Tab Bar控制器中,并且我已经在代码示例中使用对建议的重复问题的答案中提供的代码。 I wasn't trying to just get it to work, but to work the way it should
我并不是想让它正常工作,而是要按照应有的方式工作
您可以尝试navigationItem.title = "Menu"
我实际上在main.strings中找到了它-在那里进行了更改,现在可以正确显示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.