我有一个带有连接到 UIViewcontrollerA 的导航 Controller 的应用程序。在 UIViewcontrollerA 内部,我有一个 TableView ,当用户单击一个单元格时,他们将被带到 UIViewcontrollerB。 UIViewcontrollerB 与 Storyboard中的 UIViewcontrollerA 或任何导航 Controller 没有任何连接。我遇到的问题是单击转到 UIViewcontrollerB 时,导航栏会失去其颜色值。有没有一种方法可以将 UIViewcontrollerA 的值传递给 UIViewcontrollerB,而不必在 UIViewcontrollerB 中手动设置它? 感谢您的帮助!
代码:
if let vc: UIViewcontrollerB = stbrd.instantiateViewController(withIdentifier: UIViewcontrollerB.UIViewcontrollerBIdentifier) as? UIViewcontrollerB {
self.navigationController?.pushViewController(vc, animated: true)
}
最佳答案
确保在 UIViewControllerB 的身份检查器中您没有禁用导航栏。我之前遇到过这个问题,我不得不将顶部栏设置为“推断”。希望这会有所帮助。
关于ios - 与 pushview Controller 保持相同的导航栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48288551/