【发布时间】:2022-01-06 08:09:46
【问题描述】:
我使用 navigationController 作为 window.rootViewController。作为 navigationController 的 rootViewController,我使用的是 tabBarController。但是当我运行应用程序时,navigationBar 的标题没有显示(我的 Tabbar Controller 出现了,我可以看到我的 viewController。没问题)。我尝试使用 viewDidload 中的以下两个代码在 tabBar 的每个 viewController 中命名 navigationBar,但仍然没有任何改变。
navigationController?.title = "title"
navigationController?.navigationBar.topItem?.title = "title"
我在 SceneDelegete 中设置了带有标签栏的 navigationController,如下所示:
let countriesTabbarController = TabBarControllerBuilder.build()
let navigationController = UINavigationController(rootViewController: countriesTabbarController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
如何为 tabBar 的每个 viewController 显示我的 navigationController 标题?
【问题讨论】:
标签: ios swift uinavigationcontroller uitabbarcontroller