Can't dismiss navigation controller in Swift

后端 未结 4 1738
深忆病人
深忆病人 2021-01-19 03:10

So I have a simple navigation controller with a sign up, hit done and you go to the home page. The problem is when you go to the home page, the navigation controller follows

相关标签:
4条回答
  • 2021-01-19 03:28
    //hide the navigation bar on this page
    override func viewWillAppear(_ animated: Bool) {
        self.navigationController?.isNavigationBarHidden = true
    }
    

    This will hide the navigation bar on your home page, but make sure you use viewWillAppear so whenever you come back to a page the navigation will not reappear.

    0 讨论(0)
  • 2021-01-19 03:47

    Try to use a ViewController only for the LoginView. Then use self.dismiss with PerformSegue to reach the NavigationController.

    0 讨论(0)
  • 2021-01-19 03:50

    Try

    self.navigationController?.popViewControllerAnimated(true)
    

    Update: Swift 4.2

    self.navigationController?.popViewController(animated: true)
    
    0 讨论(0)
  • 2021-01-19 03:54

    Is a signup view controller being presented Modally? Then, on sign up view controller, you could do

    self.dismiss(animated: true, completion: nil) 
    
    0 讨论(0)
提交回复
热议问题