我想用一根手指触摸来围绕中心点旋转下面的图像...
并且我想在旋转图像时用标签显示图像的值。
我已经完成了图像旋转,但问题是如何根据旋转设置图像的值。
旋转角度不断增加,因此我无法设置该值。
有人能帮忙吗?
以下是代码:
并且我想在旋转图像时用标签显示图像的值。
我已经完成了图像旋转,但问题是如何根据旋转设置图像的值。
旋转角度不断增加,因此我无法设置该值。
有人能帮忙吗?
以下是代码:
float fromAngle = atan2(firstLoc.y-imageView.center.y,
firstLoc.x-imageView.center.x);
NSLog(@"From angle:%f",fromAngle);
float toAngle = atan2( currentLoc.y-imageView.center.y,
currentLoc.x-imageView.center.x);
NSLog(@"to Angle:%f",toAngle);
// So the angle to rotate to is relative to our current angle and the
// angle through which our finger moved (to-from)
float newAngle =angle+(toAngle-fromAngle);
NSLog(@"new angle:%.2f",newAngle);
CGAffineTransform cgaRotate = CGAffineTransformMakeRotation(newAngle);
imageView.transform=cgaRotate;
angle = newAngle;
有人能帮我吗?