【发布时间】:2023-08-25 18:09:02
【问题描述】:
我有一个视图,我正在使用CABasicAnimation 旋转该视图。
现在我的问题是我如何在旋转时获得该视图的完美位置。我尝试了许多类型的代码,但在该视图的旋转过程中我无法获得完美的位置。
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
NSNumber *currentAngle = [CircleView.layer.presentationLayer valueForKeyPath:@"transform.rotation"];
rotationAnimation.fromValue = currentAngle;
rotationAnimation.toValue = @(50*M_PI);
rotationAnimation.duration = 50.0f; // this might be too fast
rotationAnimation.repeatCount = HUGE_VALF; // HUGE_VALF is defined in math.h so import it
[CircleView.layer addAnimation:rotationAnimation forKey:@"rotationAnimationleft"];
我正在使用此代码来旋转我的视图。
我还附上了一张我的观点的照片。
提前谢谢你,如果你知道的话,请帮忙。
【问题讨论】:
标签: ios iphone rotation position cabasicanimation