Search code examples
iosios5uistoryboardsegue

Pop the current view using Segues/Storyboard on iOS 5


I am creating an app using iOS 5 SDK. I managed to push views using the Storyboard's Segues, but I cannot find the proper way to pop the current view and go back to the previous one.

I am not using any navigationController (the app doesn't have any top or bottom bars).

I don't think using modal or push segue the other way would be the solution as it instantiates a new controller.

Do I have to use a custom Segue with the opposite animation and deletion of the view at the end ? Or is there a better way ?


Solution

  • You could try calling [self dismissViewControllerAnimated:YES completion:nil]; from the controller you want to dismiss (whether the controller has been pushed, or shown modally).

    Here is the related documentation : UIViewController Class Reference

    The presenting view controller is responsible for dismissing the view controller it presented. If you call this method on the presented view controller itself, it automatically forwards the message to the presenting view controller.