froggomad
froggomad

Reputation: 1915

Swift storyboard title won't change

I have a VC embedded in a Tab Bar Controller. The VC had the title "Profile" set in storyboard, and I changed this to "Menu". 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.

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.

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. 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. I wasn't trying to just get it to work, but to work the way it should

Upvotes: 0

Views: 141

Answers (2)

froggomad
froggomad

Reputation: 1915

I actually found it in main.strings - changed it there and it's displaying properly now

Upvotes: 1

jun
jun

Reputation: 59

you can try navigationItem.title = "Menu"

Upvotes: 1

Related Questions