0
我有以下几点:旋转图像指向
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),使其看起来直接朝TARGETPOINT。
我的想法是:计算对应于x轴的角度,减去旋转,然后旋转它。
两件事:
1)我没有计算角度。 (是的,我知道这一切都在拉德......)
2.)什么是最好的旋转?
- CGAffineTransform?但后来我需要一个imageView
- 或者:保存上下文,将原点设置为图像中心,旋转上下文,绘制图像,恢复上下文?更复杂,但没有imageview需要...
是的,但我仍然必须计算角度.... – hutattedonmyarm
好吧,我做了那...你可以帮助我与CALayer的东西吗?我有我的形象,需要旋转x弧度.... – hutattedonmyarm