Search code examples
iphoneioscore-animationcalayerquartz-graphics

CATransition animation key always "transition"


Got a basic CATranisition. Works.

        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];

Here's the rub tho:

        [self.icon.layer animationForKey:animationKey]

always returns NULL.

When I do:

        [self.icon.layer animationKeys]

I get:

        icon keys: (
transition
         )

What am I missing here?


Solution

  • CALayer reference says "The special key kCATransition is automatically used for transition animations."