Search code examples
iosswiftuinavigationcontrolleruinavigationbar

Can i fixed UINavigationBar's TopBar on the way swipe gesture


I want UINavigationBar's Topbar on the way swipe gesture.

My storyboard is like this:

LoginViewController(UINavigationController) =>(pushViewController) RegisterViewController

I tried some methods, The most similar answer is

  1. LoginViewController's Navigation bar set to hidden. setNavigationBarHidden(true, animated: true)
  2. RegisterViewController's Navigation bar set to show. self.navigationController?.setNavigationBarHidden(false, animated: true)

But, This method is must have LoginViewController's navigation bar set to hidden.

Is there another good way?

Result) https://puu.sh/Ei30r/14dc30d883.jpg

I want) https://puu.sh/Ei32K/437b731c80.jpg

Replace img tag with link because i have not at least 10 reputation.

Sorry,


Solution

  • I've tried this and it worked. You can give it a try.

    on LoginViewController's

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

    on RegisterViewController's

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