Will Larche
Will Larche

Reputation: 3149

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?

Upvotes: 0

Views: 966

Answers (1)

Kreiri
Kreiri

Reputation: 7850

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

Upvotes: 2

Related Questions