gpt4 book ai didi

iphone - 无法设置 UINavigationController 标题

转载 作者:搜寻专家 更新时间:2023-10-30 20:11:25 25 4
gpt4 key购买 nike

下面是我在我的应用程序中设置内容的方式。我有一个 UINavigationController,它有一个 UITabBarController 作为 rootViewControllerrootViewController 中有 3 个选项卡。我尝试了很多不同的方式来设置标题,包括:

self.title = @"title";

self.navigationController.title = @"title";

self.navigationItem.title = @"title";

都没有用

这是为什么?

更新:

出于某些奇怪的原因 self.parentViewController.title = @"Map"; 确实有效....

最佳答案

我猜您想要的是设置出现在导航栏中央的文本。如果是这样,navigationItem 肯定不是你想要的。那是为了在导航栏中设置按钮。

设置标题不太明显的部分是,将出现在导航栏中的文本是位于顶部的 ViewController 的标题。换句话说,最后一个被推送的 ViewController。所以你要做的是在你的 ViewContoller 中设置你的 self.title。你可以通过 ViewContollerinitviewDidLoad 来实现。

关于iphone - 无法设置 UINavigationController 标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7304554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com