开发者

Use PanGestureRecognizer translationInView to track touch location

开发者 https://www.devze.com 2023-01-10 07:43 出处:网络
How would i use a PanGestureRecognizer\'s translationInView which returns a CGPoint, to track the user touch location so that i can rotate an image so that the point where the user touches stays under

How would i use a PanGestureRecognizer's translationInView which returns a CGPoint, to track the user touch location so that i can rotate an image so that the point where the user touches stays under the finger?

I can use CGAffineTransformRotate to do the rotation but it expe开发者_如何学JAVActs a rotation angle in radians. Currently i am using M_PI/20;

Thanks


add this to your code:

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


Apple provides these GLKit functions for conversion:

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

精彩评论

暂无评论...
验证码 换一张
取 消