You can create a custom recognizer by subclassing
UIGestureRecognizer and implementing one or more of the touch event handlers. You are also likely to implement other methods from the superclass, as well as your own logic and state variables.
The recognizer has two main jobs: Keep the gestures state up to date and recognize your custom stroke and/or perform your custom behavior. The main event handler methods follow the sequence of a stroke:
touchesBegan:withEvent: is sent when the touches first occur—that is, when the user touches the screen.
touchesMoved:withEvent: is sent each time the user moves one or more ...