How dismiss a viewController with storyboard from a push segue? How dismiss a viewController with storyboard from a push segue? objective-c objective-c

How dismiss a viewController with storyboard from a push segue?


Do you have a navigationBar in the viewController that's calling:

[self performSegueWithIdentifier:@"my_segue" sender:self];

If so, you'll need to use:

[self.navigationController popViewControllerAnimated:YES];

to pop the view off the stack. There's one segue call, but the framework seems to call:

presentViewController:animated:completion:

or:

pushViewController:animated:

as appropriate.

Ray


You could just call

[self dismissViewControllerAnimated:YES completion:nil];

from the view controller since the view controller was pushed by segue.


[my_segue_view_controller dismissModalViewControllerAnimated: YES] ?

(not sure, but it works in my practice)