1.When a gesture recognizer recognizes its specified gesture, it sends an action message to its target. To create a gesture recognizer, you initialize it with a target and an action.Often, the target object is the view’s view controller.ypically, you create a gesture recognizer in your view controller’s viewDidLoad method。
UISwipeGestureRecognizer *swipeLeftGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handSwipeLeft:)];
2.
There are three things you do to add a built-in gesture recognizer to your app:
-
Create and configure a gesture recognizer instance.
This step includes assigning a target, action, and sometimes assigning gesture-specific attributes (such as the
numberOfTapsRequired). -
Attach the gesture recognizer to a view.
-
Implement the action method that handles the gesture.
3.
UISwipeGestureRecognizer property direction.The default direction is UISwipeGestureRecognizerDirectionRight.
4.
when a touch occurs, the touch object is passed from the UIApplication object to the UIWindow object. Then, the window first sends touches to any gesture recognizers attached the view where the touches occurred (or to that view’s superviews), before it passes the touch to the view object itself.
浙公网安备 33010602011771号