即使设置正确,大标题仍隐藏在 ViewController 中
Large title hidden in ViewController even though properly set
我的 NavigationController 有一些问题,特别是标题。尽管我认为我正确设置了大标题,但它在模拟器中显示不正确。
Link 到 GitHub:Github link
我试过:
- 正在重新启动 Xcode 和模拟器
- 删除 & re-adding NavigationController
- 附上代码供参考:
navigationController?.title = "Groceries"
self.navigationItem.title = "Groceries1"
title = "Groceries2"
None 以上解决了问题。问题只存在于 AccountViewController 和 TableViewController 上,它们都连接到 TabBar。
可能相关的内容:
self.navigationItem.setHidesBackButton(true, animated: true)
也不行。
如何确保显示标题? (如果相关:如何确保隐藏后退按钮?)
非常感谢。
我加了
title = "MMMMMM"
在 LoginViewController 的 viewDidLoad 中,您的代码在我这边工作正常。
您也可以使用故事板来替代它。
步骤:
(1) 转到故事板中的视图控制器。
(2) 转到编辑器 -> 嵌入导航控制器。
(3) 现在在视图控制器中,select 导航项,转到属性
检查员并设置您的标题。
如有其他问题,欢迎随时提问。
问题是我试图编辑 NavigationController 的标题,而 NavigationController 被 TabBarController 覆盖了。我设法通过在 ViewWillAppear 中放置以下内容来解决问题:
tabBarController?.title = "Groceries"
这已经解决了问题。感谢大家花时间调查这个问题!
我的 NavigationController 有一些问题,特别是标题。尽管我认为我正确设置了大标题,但它在模拟器中显示不正确。
Link 到 GitHub:Github link
我试过:
- 正在重新启动 Xcode 和模拟器
- 删除 & re-adding NavigationController
- 附上代码供参考:
navigationController?.title = "Groceries"
self.navigationItem.title = "Groceries1"
title = "Groceries2"
None 以上解决了问题。问题只存在于 AccountViewController 和 TableViewController 上,它们都连接到 TabBar。
可能相关的内容:
self.navigationItem.setHidesBackButton(true, animated: true)
也不行。 如何确保显示标题? (如果相关:如何确保隐藏后退按钮?)
非常感谢。
我加了
title = "MMMMMM"
在 LoginViewController 的 viewDidLoad 中,您的代码在我这边工作正常。
您也可以使用故事板来替代它。 步骤:
(1) 转到故事板中的视图控制器。
(2) 转到编辑器 -> 嵌入导航控制器。
(3) 现在在视图控制器中,select 导航项,转到属性 检查员并设置您的标题。
如有其他问题,欢迎随时提问。
问题是我试图编辑 NavigationController 的标题,而 NavigationController 被 TabBarController 覆盖了。我设法通过在 ViewWillAppear 中放置以下内容来解决问题:
tabBarController?.title = "Groceries"
这已经解决了问题。感谢大家花时间调查这个问题!