Can't dismiss navigation controller in Swift
Solution 1
Try
self.navigationController?.popViewControllerAnimated(true)
Update: Swift 4.2
self.navigationController?.popViewController(animated: true)
Solution 2
Is a signup view controller being presented Modally? Then, on sign up view controller, you could do
self.dismiss(animated: true, completion: nil)
Solution 3
Try to use a ViewController
only for the LoginView. Then use self.dismiss
with PerformSegue
to reach the NavigationController
.
Idris
Updated on June 30, 2022Comments
-
Idris almost 2 years
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.
As you can see in the last picture (home page), the navigation bar remains. When the user presses "Done" on the first image I use
self.performSegueWithIdentifier("loginTrue", sender: nil)
to go to the "home page". I've tried usingself.presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
But nothing seems to happen. So to wrap it all up, any idea on how I can "dismiss" the navigation controller from the "home page"? Thanks!