Uipangesturerecognizer is mainly used for dragging, for example, there is a picture on the desktop Uiimageview, you want it to be dragged from the original position to any position, that is, the picture with your finger walking, then you need to use the class.
The following code indicates that a uipangesturerecognizer gesture is assigned to a picture view to invoke the callback function when the picture is captured to the user's drag gesture Handlepan
C code
-
- [Self.imgview Setuserinteractionenabled:yes];
- [Self.imgview Addgesturerecognizer:pan];
- [Pan release];
The Handlepan function code is as follows:
C code
- - (void ) handlePan: (uipangesturerecognizer *) rec{
- " Xxoo---xxoo---xxoo ");
- "%f,%f ", point.x,point.y);
-
- [Rec settranslation:cgpointmake (0, 0) InView:self.view];
- }
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Translationinview in Uipangesturerecognizer class