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.
精彩评论