UITabBar + UINavigationBar 标题冲突

发布于 2024-08-19 09:32:37 字数 235 浏览 6 评论 0原文

我在 IB 中创建了一个 UITabBar 和一个 UINavigationBar,当我每次导航 UINavigation 标题更改时启动应用程序时,因为我使用的

self.title = @"NAME"; 

问题是 UITabBarItem 将同时以相同的名称更改。 我只想为 UITabBarItem 添加一个静态名称,如何在 IB 中或以编程方式执行此操作。

谢谢,

I have a UITabBar and a UINavigationBar created in IB, when I launch my application everytime I navigate the UINavigation title change because I'm using

self.title = @"NAME"; 

my problem is that the UITabBarItem will change with the same name at the same time.
I want to put a static name only for the UITabBarItem, how to do it in IB or programatically maybe.

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

末が日狂欢 2024-08-26 09:32:37

尝试为您的控制器返回一个显式的 tabBarItem,并自己设置其标题。

- (UITabBarItem *) tabBarItem {
    return [[[UITabBarItem alloc] initWithTitle: ...

try returning an explicit tabBarItem for your controller, and set its title yourself.

- (UITabBarItem *) tabBarItem {
    return [[[UITabBarItem alloc] initWithTitle: ...
想念有你 2024-08-26 09:32:37

我在这个地址中找到了解决方案 Stackoverflow navigationItem Title 抱歉,我之前没有找到它发布我的问题。

I find the solution in this adress Stackoverflow navigationItem Title Sorry I didn't find it before posting my question.

迷乱花海 2024-08-26 09:32:37

试试这个,在你的 viewDidLoad 中

self.tabBarController.navigationItem.title = @"title";

try this, in your viewDidLoad

self.tabBarController.navigationItem.title = @"title";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文