2010-08-02 81 views
0

我将如何使用PanGestureRecognizer的translationInView返回CGPoint,跟踪用户的触摸位置,以便我可以旋转图像,以便用户触摸的位置保持在手指下方?使用PanGestureRecognizer translationInView来跟踪触摸位置

我可以使用CGAffineTransformRotate做旋转,但它需要以弧度为单位的旋转角度。目前我使用M_PI/20;

感谢

回答

1

添加到您的代码:

#define degreesToRadians(degrees) (M_PI * degrees/180.0) 
#define radiansToDegrees(radians) (radians * 180/M_PI) 
0

苹果提供这些GLKit functions转换:

func GLKMathDegreesToRadians(_ degrees: Float) -> Float 
func GLKMathRadiansToDegrees(_ radians: Float) -> Float