我合并tabbarcontroller
与 navigationcontroller
.
我设置了navigationitem title
通过使用,
self.tabBarController?.navigationItem.title = "first"
第一页
self.tabBarController?.navigationItem.title = "second"
第二页,标题显示。
但是当我切换到第二页,再切换回第一页时,标题仍然显示为 second
.它没有变回first
.
我该如何解决?
最佳答案
尝试在您的 View Controller 的 viewDidLoad 方法中设置标题,如下所示:
self.navigationItem.title = "First Page" // in First Page ViewController
self.navigationItem.title = "Second Page" // in Second Page View Controller
这样无论何时您切换到其他 View Controller ,标题都会相应地设置..
希望对你有帮助..
关于swift - UITabBarController UINavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37043587/