我有NavigationViewController
,带有白色导航栏颜色。从firstViewController
到secondViewController
时,我在导航栏中看到灰色。我要删除此灰色。如何解决?
firstViewController
:
转到secondViewController
:
secondViewController
:
如何删除它:
我的代码:
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11.0, *) {
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationItem.largeTitleDisplayMode = .always
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.backgroundColor = UIColor.white
} else {
// Fallback on earlier versions
}
}
答案 0 :(得分:0)
您需要将isTranslucent属性设置为true
self.navigationController?.navigationBar.isTranslucent = true
答案 1 :(得分:0)
self.navigationController?.navigationBar.barTintColor = .white
self.navigationController?.navigationBar.shadowImage = image
self.navigationController?.navigationBar.setBackgroundImage(image, for: .default)