I have created a simple unwind segue using the storyboard tools. I have created the following event handler in the view I want to unwind to:
-(IBAction)quitQ
Set up a delegate and inform your source view controller about quitting the quiz and send back the data. Don't forget to set the source view controller as the delegate of the destination view controller.
// DestinationViewController.h
@protocol DestingationDelegate;
@interface
...
@property (assign) id delegate;
...
@end
@protocol DestinationDelegate
-(void)didQuitQuiz:(NSDictionary*)infoDict;
@end
// DestinationViewController.m
-(IBAction)quitQuiz:(UIStoryboardSegue *)segue {
NSLog(@"SEGUE unwind");
if (self.delegate) [self.delegate didQuitQuiz:infoDict];
}
// SourceViewController.h
#import DestinationViewController.h
@interface SourceViewController : ViewController
....
// SourceViewController.m
-(void)didQuitQuiz:(NSDictionary *)infoDict {
if (infoDict) {
// do something with the data
}
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
...
destinationViewController.delegate = self;
}