Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't dismiss navigation controller in Swift

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.

enter image description here

enter image description here

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 using

self.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!

like image 798
Idris Avatar asked Jun 29 '15 20:06

Idris


1 Answers

Try

self.navigationController?.popViewControllerAnimated(true)

Update: Swift 4.2

self.navigationController?.popViewController(animated: true)
like image 69
user3687284 Avatar answered Sep 23 '22 19:09

user3687284