开发者

executing code (selector) while animating CABasicAnimation

CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
rotationAnimation.toValue = [NSNumber numberWithFloat: 2*M_PI];
rotationAnimation.duration = 1.0;
[self.layer addAnimation:rotationAnimation forKey:@"rotationAnimation1"];

I would like to execute code when the degree is M_PI, in other words I have two buttons on the UIView and I wan开发者_运维知识库t to change the labels of them while rotating the UIView and I don't want the user to feel the the buttons are changing in front of him so , best way is to execute the label changing while the UIView is rotating to half of the way.

Help me


Split your rotationAnimation in two steps, each of M_PI radians rotation. When the first animation is done (i.e., from the animation's delegate animationDidStop:finished: function) start the second while also changing the label.

Or you could simply start the second animation after 0.5 sec.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜