移至上一个屏幕时,如何摆脱更改导航栏颜色的延迟?

时间:2018-08-02 09:46:30

标签: ios swift uikit

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
    self.navigationController?.navigationBar.shadowImage = UIImage()
    self.navigationController?.navigationBar.isTranslucent = true
    self.tabBarController?.tabBar.isHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    self.navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
    self.navigationController?.navigationBar.shadowImage = nil
    self.tabBarController?.tabBar.isHidden = false
}

点击后退(NavBar)后,我看到一个延迟(1.5 s)。我不明白为什么。

1 个答案:

答案 0 :(得分:0)

Func willMove from docs可以帮助我。