UILongPressGestureRecognizer is a concrete subclass of UIGestureRecognizer that looks for long-press gestures. The user must press one or more fingers on a view and hold them there for a minimum period of time before the action triggers. While down, the user’s fingers may not move more than a specified distance; if they move beyond the specified distance, the gesture fails.


Long-press gestures are continuous. The gesture begins (began) when the number of allowable fingers (numberOfTouchesRequired) have been pressed for the specified period (minimumPressDuration) and the touches do not move beyond the allowable range of movement (allowableMovement). The gesture recognizer transitions to the Change state whenever a finger moves, and it ends (ended) when any of the fingers are lifted.


Configuring the Gesture Recognizer

var minimumPressDuration: CFTimeInterval

The minimum period fingers must press on the view for the gesture to be recognized.

var numberOfTouchesRequired: Int

The number of fingers that must be pressed on the view for the gesture to be recognized.

var numberOfTapsRequired: Int

The number of taps on the view required for the gesture to be recognized.

var allowableMovement: CGFloat

The maximum movement of the fingers on the view before the gesture fails.


Inherits From

Conforms To