UIPanGestureRecognizer
A continuous gesture recognizer that interprets panning gestures.
Declaration
@MainActor class UIPanGestureRecognizerMentioned in
Overview
UIPanGestureRecognizer is a concrete subclass of UIGestureRecognizer.
Clients of this class can, in their action methods, query the UIPanGestureRecognizer object for the current translation of the gesture (translation(in:)) and the velocity of the translation (velocity(in:)). They can specify a view’s coordinate system to use for the translation and velocity values. Clients can also reset the translation to a desired value.
A panning gesture is continuous. The user must press one or more fingers on a view while panning it. The gesture begins (UIGestureRecognizer.State.began) when the user moves the minimum number of fingers allowed (minimumNumberOfTouches) enough distance for recognition as a pan. It changes (UIGestureRecognizer.State.changed) when the user moves a finger while pressing with the minimum number of fingers. It ends (UIGestureRecognizer.State.ended) when the user lifts all fingers.
Topics
Configuring the gesture recognizer
Tracking the location and velocity of the gesture
Tracking scroll events
See Also
Standard gestures
Handling UIKit gesturesCoordinating multiple gesture recognizersAdopting hover support for Apple PencilSupporting gesture interaction in your appsUIHoverGestureRecognizerUILongPressGestureRecognizerUIPinchGestureRecognizerUIRotationGestureRecognizerUIScreenEdgePanGestureRecognizerUISwipeGestureRecognizerUITapGestureRecognizer