有一个基本的CATranisition。作品。

        animationKey = @"fadeIn";

        [self.icon setImage:self.iconSelected];
        [self.shadow setAlpha:1.0];
        CATransition *transitionIn = [CATransition animation];
        transitionIn.removedOnCompletion = NO;
        transitionIn.delegate = self;
        transitionIn.duration = 1.2;
        transitionIn.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transitionIn.type = kCATransitionFade;

        [self.icon.layer addAnimation:transitionIn forKey:animationKey];
        [self.shadow.layer addAnimation:transitionIn forKey:animationKey];
        [CATransaction commit];


这是摩擦声:

        [self.icon.layer animationForKey:animationKey]


始终返回NULL。

当我做:

        [self.icon.layer animationKeys]


我得到:

        icon keys: (
transition
         )


我在这里想念什么?

最佳答案

CALayer reference说:“特殊键kCATransition自动用于过渡动画。”

10-08 05:35