如何获得完美的旋转UIView的X,Y位置在ios中

我正在使用CABasicanimation旋转UIView。 我正在使用这个代码,

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"]; 

在这个我想要完美的X,Y位置,而“UIView”旋转。 如果有人知道请帮助我。

先谢谢你。 在这里输入图像说明

我有这个问题的答案请转到此链接的答案

去这个链接的答案

所以,如果我正确地理解了你,你只想在旋转过程中获得视图的X和Y坐标?

您可以通过loggingpresentationLayer的框架来做到这一点,如下所示:

 - (IBAction)buttonAction:(UIButton *)sender { CGRect position = [[CircleView.layer presentationLayer] frame]; NSLog(@"%@", NSStringFromCGRect(position)); }