Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Yuchen Yang
2,464 Pointsquestion about navigation controller
Does a ViewController get destroyed when you pop it off a navigation controller?
2 Answers
landonferrier
25,097 PointsYuchen, no, the view controller will still exist in your storyboard but it will no longer exist in the chain of the navigation controller. Without using a button from the navigation controller, you can perform a segue using the following code:
Swift:
self.performSegueWithIdentifier("Your segue identifier set in the storyboard.", sender: self)
Objective-C:
[self performSegueWithIdentifier:@"Your segue identifier set in the storyboard." sender:self];
For most scenarios, you can set the sender to be self.
If you have any questions, feel free to ask!
Misho Milicevic
5,597 PointsI'm not sure if I get your question right but if you mean deleting the segue between the navigation controller and the view controller, the answer is no the ViewController does not get destroyed.