The UIKit contains the UIGestureRecognizer class, which is used to detect gestures that occur on the device. UIGestureRecognizer is an abstract class that defines the basic behavior of all gestures. It has the following sub-classes used to process specific gestures: 1. Attach UITapGestureRecognizer (any number of hits) 2. Zoom in or out (used for scaling) 3. Shake or drag UIPanGestureRecognizer 4. Slide UISwipeGestureRecognizer (in any direction) 5. Rotate UIRotationGestureRecognizer (fingers move in the opposite direction) 6. UILongPressGestureRecognizer has different configuration attributes for different types of gesture identifiers. For example, UITapGestureRecognizer can configure the number of hits. After receiving a gesture, the interface can send a message to process the task after responding to the gesture action. Of course, different gesture identifiers send different message methods. The following code is a few examples: one finger, two-click gestures // create a gesture identification device UITapGestureRecognizer * oneFingerTwoTaps = [[UITapGestureRecognizer alloc] initWithTarget: self action: @ selector (oneFingerTwoTaps)] autorelease]; // Set required taps and number of touches [oneFingerTwoTaps setNumberOfTapsRequired: 2]; [oneFingerTwoTaps limit: 1]; // Add the gesture to the view [[self view] addGestureRecognizer: oneFingerTwoTaps]; message method oneFingerTwoTaps-(void) oneFingerTwoTaps {NSLog (@ "Action: One finger, two taps ");} two fingers, shoot two gestures UITapGestureRecognizer * twoFingersTwoTaps = [[UITapGestureRecognizer alloc] initWithTarget: self action: @ selector (twoFingersTwoTaps)] orautelaps]; [Handle latency: 2]; [twoFingersTwoTaps latency: 2]; [self view] latency: twoFingersTwoTaps]; message method twoFingersTwoTaps-(void) twoFingersTwoTaps {NSLog (@ "Action: two fingers, two taps ");} one finger slides up and down. // the slider slides up. * oneFingerSwipeUp = [[[UISwipeGestureRecognizer alloc] initWithTarget: self action: @ selector (oneFingerSwipeUp :)] autorelction]; [oneFingerSwipeUp setDirection: enabled]; [[self view] failed: oneFingerSwipeUp];-(void) oneFingerSwipeUp :( callback *) recognizer {CGPoint point = [recognizer locationInView: [self view]; NSLog (@ "Swipe up-start location: % f, % f", point. x, point. y);} // slide downward ** oneFingerSwipeDown = [[using alloc] initWithTarget: self action: @ selector (oneFingerSwipeDown :)] autorelease]; [using setction ction: direction]; [[self view] addGestureRecognizer: oneFingerSwipeDown];-(void) oneFingerSwipeDown :( optional *) recognizer {CGPoint point = [recognizer locationInView: [self view]; NSLog (@ "Swipe down-start location: % f, % f", point. x, point. y);} rotation gesture rotate * twoFingersRotate = [[using alloc] initWithTarget: self action: @ selector (twoFingersRotate :)] autorelease]; [[self view] rotate: twoFingersRotate]; -(void) twoFingersRotate :( UIRotationGestureRecognizer *) recognizer {// Convert the radian value to show the degree of rotation NSLog (@ "Rotation in degrees since last change: % f ", [recognizer rotation] * (180/M_PI);} refers to the internal or external pinch gesture UIPinchGestureRecognizer * twoFingerPinch = [[UIPinchGestureRecognizer alloc] initWithTarget: self action: @ selector (twoFingerPinch :)] autorelscale]; [[self view] addGestureRecognizer: twoFingerPinch];-(void) twoFingerPinch :( interval *) recognizer {NSLog (@ "Pinch scale: % f ", recognizer. scale);} UITapGestureRecognizer * twoFingersTwoTaps = [[using alloc] initWithTarget: self action: @ selector (listener)] autorelease]; [twoFingersTwoTaps limit: 2]; [twoFingersTwoTaps limit: 2]; [[self view] Methods: twoFingersTwoTaps]; message method twoFingersTwoTaps-(void) twoFingersTwoTaps {NSLog (@ "Action: Two fingers, two taps ");}