我通过 AppDelegate 中的以下代码行向 UINavigationBar 添加了色调:
let navBar = UINavigationBar.appearance()
navBar.barTintColor = mainColor
但是,当我通过 segue 进入不同的 View 时,我失去了颜色。 View 2 未嵌入其自己的 UINavigationController 中。
如果我将它嵌入到导航 Controller 中,它就会出现,但是如果我从 View 2 转到 View 3,它也会消失。
我使用“显示”作为 segue 选项。
最佳答案
我使用了 @IBAction 操作从 View 2 转到 View 3。这就是我必须替换的原因
navigationController?.popViewControllerAnimated(true)
具有以下内容:
self.dismissViewControllerAnimated(true, completion: nil)
我是通过 - Go back to previous view controller doesn't work 了解到这一点的
关于swift - 当我显示新的 UIView 时,UINavigationBar 失去色调颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37158387/