I have the following setup:

The red controller has a method
- (IBAction)unwindToRed:(UISegue *)segue
and a
- (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier
which returns the user segment for this event.
In my custom segue, the execution code has the following:
- (void)perform { // Just helpers to get the controllers from the segue UIViewController *destination = self.destinationViewController; UIViewController *source = self.sourceViewController; // Setting transitioning delegate for custom transitions destination.transitioningDelegate = self; source.transitioningDelegate = self; destination.modalTransitionStyle = UIModalPresentationCustom; source.modalPresentationStyle = UIModalPresentationCurrentContext; // When I am transitioning to a new one if(!self.reversed) { [source presentViewController:destination animated:YES completion:nil]; } // Or reversing from a current one else { [source dismissViewControllerAnimated:YES completion:nil]; } }
As you can see, I have set up a transition delegate, which in turn causes
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext
on the animation controller, where I apply my custom animation. But now, when I click Unwind to Red on the yellow view, it only "unwinds" its parent. (e.g. blue).
When I leave the custom segue out of the equation, it works just fine. It goes the way up.
Now I think this is due to
[source dismissViewControllerAnimated:YES]
since this is usually just a βone-upβ question, I think I should call it so that it reaches red when it was necessary? Yellow is a modal overlay. So "pop too root" will not work.