Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to run code upon a return from a segue

I'm trying to find a method to catch a return from a segue to the root controller so I can run custom code that will make a decision on where to go next. I've tried the two methods below and they don't do the trick as they seem to (obviously) be concerned with unwinding a segue stack. Any thoughts out there?

-(UIStoryboardSegue *)segueForUnwindingToViewController
{
}

-(BOOL)canPerformUnwindSegueAction
{
}
like image 542
Grymjack Avatar asked Jan 22 '13 08:01

Grymjack


2 Answers

Just for iOS 6:

"In the controller you wish to return to, implement a method that returns an IBAction, and that takes a single UIStoryboardSegue argument:

- (IBAction)returnActionForSegue:(UIStoryboardSegue *)returnSegue {

// do useful actions here.

}

Now, in the scene we wish to unwind, control-drag from the UI element that will trigger the return to the scene's exit icon (the green icon in the dock). In the popup menu, select the previously defined return item."

more here: http://www.freelancemadscience.com/fmslabs_blog/2012/9/24/advanced-storyboard-techniques.html

like image 84
TonyMkenu Avatar answered Sep 28 '22 01:09

TonyMkenu


Your method calls are incomplete. Here is another post that gives some good examples of how to use the unwind method:

What are unwind segues for and how to use them

like image 43
Scott Beard Avatar answered Sep 28 '22 00:09

Scott Beard