UIViewControllerTransitioningDelegate method not called

718 Views Asked by At

I implemented this method on the controller to present:

- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
    return [[MyAnimationController alloc] init];
}

Here are my initWithCoder: method on that view controller:

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.transitioningDelegate = self;
        self.modalPresentationStyle = UIModalPresentationCustom;
    }
    return self;
}

MyAnimationController.m:

@implementation MyAnimationController

- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext {
    return 0.5;
}

- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
    NSLog(@"Start Transition");
    [transitionContext completeTransition:YES];
}

@end

I never received the NSLog and the UIViewControllerTransitioningDelegate method was not called either. Anyone knows why?

0

There are 0 best solutions below