¡@

Home 

2014/10/15 ¤U¤È 10:03:36

iphone Programming Glossary: ang

How to rotate image around center point automatically with finger touch

http://stackoverflow.com/questions/1119743/how-to-rotate-image-around-center-point-automatically-with-finger-touch

rotate during the touch events TouchesBegan Touchesoved TouchesEnd . I used this code in TouchesMoved to find out the angle in witch to rotate the image. public override void TouchesMoved NSSet touches UIEvent evt PointF pt touches.AnyObject.. pt touches.AnyObject as UITouch .LocationInView this float x pt.X this.Center.X float y pt.Y this.Center.Y double ang Math.Atan2 x y yada yada rotate image using this.Transform THIS IS IMPORTANT When the ImageView rotates even the x y coordinates.. y yada yada rotate image using this.Transform THIS IS IMPORTANT When the ImageView rotates even the x y coordinates changes. So touching the same area all the time would give me different values in the pt and prePt points. After some thinking..

How to rotate and resize the image view with single finger

http://stackoverflow.com/questions/12566791/how-to-rotate-and-resize-the-image-view-with-single-finger

recommends you to use CGAffineTransformMakeRotation and atan2 functions to solve the rotation problem like this float ang atan2 recognizer locationInView self.superview .y self.center.y recognizer locationInView self.superview .x self.center.x.. locationInView self.superview .y self.center.y recognizer locationInView self.superview .x self.center.x float angleDiff deltaAngle ang self.transform CGAffineTransformMakeRotation angleDiff Third be sure to use relative coordinate like.. self.superview .y self.center.y recognizer locationInView self.superview .x self.center.x float angleDiff deltaAngle ang self.transform CGAffineTransformMakeRotation angleDiff Third be sure to use relative coordinate like this self.transform..