迅速:酒吧中的灰色

时间:2018-09-19 13:09:10

标签: ios swift

我有NavigationViewController,带有白色导航栏颜色。从firstViewControllersecondViewController时,我在导航栏中看到灰色。我要删除此灰色。如何解决?

firstViewController

enter image description here

转到secondViewController

enter image description here

secondViewController

enter image description here

如何删除它:

enter image description here

我的代码:

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
        }
}

2 个答案:

答案 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)