我正在尝试将 CALayer 旋转到特定角度,但是,一旦动画完成,图层就会跳回其原始位置。我将如何正确旋转图层以使其保持在最终目的地?
这是我正在使用的代码
CABasicAnimation *rotationAnimation =[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; //Rotate about z-axis
[rotationAnimation setFromValue:[NSNumber numberWithFloat:fromDegree]];
[rotationAnimation setToValue:[NSNumber numberWithFloat:toDegree]];
[rotationAnimation setDuration:0.2];
[rotationAnimation setRemovedOnCompletion:YES];
[rotationAnimation setFillMode:kCAFillModeForwards];
有什么建议么?谢谢你。