Class

UIPanGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for panning (dragging) gestures.

Declaration

@interface UIPanGestureRecognizer : UIGestureRecognizer

Overview

The user must be pressing one or more fingers on a view while they pan it. Clients implementing the action method for this gesture recognizer can ask it for the current translation and velocity of the gesture.

A panning gesture is continuous. It begins (UIGestureRecognizerStateBegan) when the minimum number of fingers allowed (minimumNumberOfTouches) has moved enough to be considered a pan. It changes (UIGestureRecognizerStateChanged) when a finger moves while at least the minimum number of fingers are pressed down. It ends (UIGestureRecognizerStateEnded) when all fingers are lifted.

Clients of this class can, in their action methods, query the UIPanGestureRecognizer object for the current translation of the gesture (translationInView:) and the velocity of the translation (velocityInView:). They can specify the view whose coordinate system should be used for the translation and velocity values. Clients may also reset the translation to a desired value.

Topics

Configuring the Gesture Recognizer

maximumNumberOfTouches

The maximum number of fingers that can be touching the view for this gesture to be recognized.

minimumNumberOfTouches

The minimum number of fingers that can be touching the view for this gesture to be recognized.

Tracking the Location and Velocity of the Gesture

- translationInView:

The translation of the pan gesture in the coordinate system of the specified view.

- setTranslation:inView:

Sets the translation value in the coordinate system of the specified view.

- velocityInView:

The velocity of the pan gesture in the coordinate system of the specified view.

Relationships

Inherits From

See Also

UIKit Gestures

Handling UIKit Gestures

Use gesture recognizers to simplify touch handling and create a consistent user experience.

Coordinating Multiple Gesture Recognizers

Discover how to use multiple gesture recognizers on the same view.

UILongPressGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for long-press gestures.

UIPinchGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for pinching gestures involving two touches.

UIScreenEdgePanGestureRecognizer

A gesture recognizer that looks for panning (dragging) gestures that start near an edge of the screen.

UISwipeGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for swiping gestures in one or more directions.

UIRotationGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for rotation gestures involving two touches.

UITapGestureRecognizer

A concrete subclass of UIGestureRecognizer that looks for single or multiple taps.