本文介绍了如何独立于标签栏项目标题更改 uiviewcontroller 标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在像这样在视图中设置我的视图控制器标题:

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"];

斯威夫特:

self.navigationItem.title = "My Title"

这篇关于如何独立于标签栏项目标题更改 uiviewcontroller 标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 07:39