未调用UIViewControllerTransitioningDelegate方法

时间:2015-06-21 20:30:54

标签: ios uikit

我在控制器上实现了这个方法来呈现:

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

这是我在该视图控制器上的initWithCoder:方法:

- (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

我从未收到过NSLog,也没有调用UIViewControllerTransitioningDelegate方法。谁知道为什么?

0 个答案:

没有答案