My question is, how do I get the following custom unwind segue to work on a device with a version prior to iOS 9 as well as on a device running iOS 9?
I
I slightly modified your code.
I don't have to consider whether push or modal.
It seems to work fine.
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier
{
UIStoryboardSegue *segue;
if ([fromViewController isKindOfClass:[MyViewController class]]) {
segue = [[CustomSegue alloc] initWithIdentifier:identifier source:fromViewController destination:toViewController]; //Custom Unwind Segue
}
else {
if ([super respondsToSelector:@selector(unwindForSegue:towardsViewController:)]) {
[super unwindForSegue:segue towardsViewController:toViewController];
}
segue = [super segueForUnwindingToViewController:toViewController fromViewController:fromViewController identifier:identifier];
}
return segue;
}