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 trialDaniel Haugstvedt
4,655 Points[self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; does nothing
I have tried google and it suggest running it on the navigationController. There are also some suggestions on running it on the self instead of the presenting view controller. I have tried all four combinations without any luck. The viewDidDisappear:(BOOL)animated method is newer called (I added a NSLog in it to check).
- (void)dismissSelf { NSLog(@"dismiss is running"); //[self.navigationController.presentingViewController dismissViewControllerAnimated:YES completion:nil]; //[self.navigationController dismissViewControllerAnimated:YES completion:nil]; //[self dismissViewControllerAnimated:YES completion:nil]; [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; }
3 Answers
Muhammad Arafat
5,677 PointsUsing
[self.dismissViewControllerAnimated:YES completion:nil];
should be enough if by self
you mean the view controller that was presented modally; which also must be the one implementing viewDidDisappear
method.
Daniel Haugstvedt
4,655 PointsAnd there it was, I simply forgot to make the segue modal. Thanks for sorting it out so quickly.
Muhammad Arafat
5,677 PointsGlad you figured it out!
Anthony Martinez
13,111 PointsWhat is the solution now that modal segues are deprecated? Facing the same issue.