【发布时间】:2011-11-28 23:58:40
【问题描述】:
我有以下几点:
CGPoint pos //center of an image
CGPoint target //a point, somewhere in the coordinate system
float rotation //the current rotation of the image to the x-axis, clockwise, so "right" would be 90°
现在我希望图像围绕它的中心点 (pos) 旋转,以便它直接朝向目标点。
我的想法是:计算x轴对应的角度,减去旋转,再旋转。
两件事:
1.) 我无法计算角度。 (是的,我知道这一切都在 rad...)
2.) 什么最适合旋转?
- CGAffine 转换?但是我需要一个 imageView
- 或者:保存上下文、将原点设置为图像中心、旋转上下文、绘制图像、恢复上下文?更复杂,但不需要 imageview...
【问题讨论】:
标签: objective-c ios4 image-rotation