UINavigationBar flash when pop (UINavigationBar just hidden on one page)

时间:2019-04-23 15:10:54

标签: uinavigationbar

I hide UINavigationBar on homepage, and show on next page.

If top view is not colorful, pop to home page may perfect.

But top view is colorful, navigation bar will flash.

You can as follow gif, first is not correct, second is correct.

error img

correct img

I just use system methods

override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        navigationController?.setNavigationBarHidden(true, animated: animated)
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        navigationController?.setNavigationBarHidden(false, animated: animated)
    }

0 个答案:

没有答案