Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if segue is unwind segue?

I have around 6 segues that perform the same action in the prepareForSegue method, however, I want to skip this action for my unwind segue but I can't figure out how to determine if the segue being passed is an unwind segue or not.

Any help would be appreciated.

like image 636
Travis M. Avatar asked Oct 12 '12 17:10

Travis M.


People also ask

What is an unwind segue?

An unwind segue lets you jump to any view controller further up your view controller hierarchy, destroying all view controllers preceding the destination. Before actually creating one, let's overview how an unwind segue works. You implement an unwind method in the destination view controller.

How do you set up unwind segue?

Connect a Triggering Object to the Exit Control In your storyboard, create an unwind segue by right-clicking a triggering object and dragging to the Exit control at the top of your view controller's scene.

What is Uistoryboardsegue?

An object that prepares for and performs the visual transition between two view controllers.

How can segues be executed in IOS application?

To create a segue between view controllers in the same storyboard file, Control-click an appropriate element in the first view controller and drag to the target view controller. The starting point of a segue must be a view or object with a defined action, such as a control, bar button item, or gesture recognizer.


2 Answers

Ah, nevermind, Robotic Cat had the answer, which is basically give the unwind segue an identifier. I couldn't figure out how to do this until I realized you can select segues from the pullout panel on the left of storyboard and set the identifier from there.

Thanks!

like image 83
Travis M. Avatar answered Nov 03 '22 05:11

Travis M.


prepareForSegue is only called in the forward direction. It is not called when you unwind. To handle unwind segues, you need to connect your exit button to an IBAction method that takes a segue as a parameter. This method will be called when you unwind.

This post has more details about how to use them.

like image 37
BeccaP Avatar answered Nov 03 '22 04:11

BeccaP