【发布时间】:2018-10-29 05:57:13
【问题描述】:
我正在尝试编写 2 个具有不同导航栏方面的 ViewController。
主 VC 有一个红色的 NavigationBar,我希望第二个是白色的。
我尝试在我的第一个 ViewController 上使用 viewWillAppear() 和 viewWillDisappear() 但结果不是很好...
override func viewWillAppear(_ animated: Bool) {
UIApplication.shared.statusBarView?.backgroundColor = smoothRed
navigationController?.navigationBar.barTintColor = smoothRed
UIApplication.shared.statusBarStyle = .lightContent
}
override func viewWillDisappear(_ animated: Bool) {
UIApplication.shared.statusBarView?.backgroundColor = UIColor.white
UIApplication.shared.statusBarStyle = .default
navigationController?.navigationBar.barTintColor = .white
}
过渡很丑……
我想要这样的东西:
你知道我该怎么做吗?
【问题讨论】:
标签: ios swift swift3 uinavigationcontroller uinavigationbar