If I set the tab bar item title in the storyboard or from code (see below), it is changed to that tab's view controller title when I tap the tab and the controller loads. I don't want this.
I want the tab bar item title that I set in the storyboard or from code to remain, without being changed. How do I achieve that?
I still want to set the controller title for the UINavigationController to show on back buttons etc.
override func viewDidLoad() {
super.viewDidLoad()
tabBarItem.title = "Keep me"
// But this overrides it, which I don't want.
title = "Don't let me change the tab bar title"
}
you can change
title = "Don't let me change the tab bar title"
to
navigationItem.title = "Don't let me change the tab bar title"
edit:
override var title: String? {
didSet{
tabBarItem.title = "you want"
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With