如何更改独立于tabbar项标题的uiviewcontroller标题 [英] how to change uiviewcontroller title independent of tabbar item title
问题描述
我正在设置我的视图控制器标题,在视图中加载:
I am setting my view controllers title like this in view did load:
self.title = @"my title";
在此之前我在故事板中为视图控制器和导航控制器设置了标题我把它设置为:标题;
prior to this I set the title in story boards for the view controller and navigation controller it is embedded in. I set it to: "Title";
当我点击保存视图控制器的标签时,标签栏项目的标题和 uiviewcontroller
更改为:我的标题
When I click on the tab that holds the view controller the title of tab bar item and uiviewcontroller
change to: my title
我希望视图控制器能够更改但标签栏项目保留标题:标题
I would like for the view controller to change but the tab bar item to stay with the title: Title
我怎样才能做到这一点?
How can I accomplish this?
推荐答案
这听起来像你想要的导航栏中的标题要更改,但不能更改标签栏中的标题。这应该这样做。
It sounds like you want the title in the navigation bar to change but not the one in the tabbar. This should do that.
[self.navigationItem setTitle:@"my title"];
Swift:
self.navigationItem.title = "My Title"
这篇关于如何更改独立于tabbar项标题的uiviewcontroller标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!