1

I have the feeling that this is a very basic question but I am using a custom Segue for a fade-in transition very similar to this: How do I do a Fade/No transition between view controllers ; I need to reverse action but am not sure how to achieve this.

The Pop operation and fades in my second view controller. Is there a way to configure this so that the back button uses the reverse of the custom subclass of UIStoryboardSegue. I know that in a custom transition, I can set UINavigationControllerOperationPop to do the reverse. Is there a simple way for me to do the reverse of my fade in Segue by using the back button?

thx

edit 1

I have seen this unwind with custom segue on UINavigationController pop via "back" button but doesn't really get me a satisfactory answer on how to get this done.

Here's my code for the segue:

// MCFadeSegue.h
#import <UIKit/UIKit.h>

@interface MCFadeSegue : UIStoryboardSegue

@end

// MCFadeSegue.m
#import "MCFadeSegue.h"
#import <QuartzCore/QuartzCore.h>

@implementation MCFadeSegue

- (void) perform
{
    CATransition* transition = [CATransition animation];

    transition.duration = 0.8;
    transition.type = kCATransitionFade;

    [[self.sourceViewController navigationController].view.layer addAnimation:transition forKey:kCATransition];
    [[self.sourceViewController navigationController] pushViewController:[self destinationViewController] animated:NO];
}
@end
Community
  • 1
  • 1
timpone
  • 19,235
  • 36
  • 121
  • 211

0 Answers0