Touches, presses, and gestures
Encapsulate your app’s event-handling logic in gesture recognizers so that you can reuse that code throughout your app.
Overview
If you build your apps using standard UIKit views and controls, UIKit automatically handles touch events (including Multitouch events) for you. However, if you use custom views to display your content, you must handle all touch events that occur in your views. There are two ways to handle touch events yourself.
Use gesture recognizers to track the touches; see Handling UIKit gestures.
Track the touches directly in your UIView subclass; see Handling touches in your view.
Topics
Essentials
Touches
Handling touches in your viewHandling input from Apple PencilTracking the force of 3D Touch eventsIllustrating the force, altitude, and azimuth properties of touch inputLeveraging touch input for drawing appsUITouch
Button presses
Standard gestures
Handling UIKit gesturesCoordinating multiple gesture recognizersAdopting hover support for Apple PencilSupporting gesture interaction in your appsUIHoverGestureRecognizerUILongPressGestureRecognizerUIPanGestureRecognizerUIPinchGestureRecognizerUIRotationGestureRecognizerUIScreenEdgePanGestureRecognizerUISwipeGestureRecognizerUITapGestureRecognizer
Custom gestures
Implementing a custom gesture recognizerUIGestureRecognizerUIGestureRecognizerDelegateSupporting gesture interaction in your apps