有一个基本的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
)
我在这里想念什么?