我有一个iPhone的基本旋转动画.有什么方法可以"暂停"动画,以便保持视图的位置?我想这样做的一种方法是让动画"完成"而不是在其上调用"删除",我该怎么做?
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2];
rotationAnimation.duration = 100;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = HUGE_VALF;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
[myView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
Run Code Online (Sandbox Code Playgroud)