Instance Property

state

The current state of the gesture recognizer.

Declaration

@property(nonatomic, readwrite) UIGestureRecognizerState state;

Discussion

The possible states a gesture recognizer can be in are represented by the constants of type UIGestureRecognizerState. Some of these states are not applicable to discrete gestures. The read-only version of the state property is intended for clients of a gesture-recognizer class and not subclasses.

Special Considerations

Subclasses of UIGestureRecognizer must use a read-write version of the state property. They get this redeclaration when they import the UIGestureRecognizerSubclass.h header file:

@property(nonatomic,readwrite) UIGestureRecognizerState state;

Recognizers for discrete gestures transition from UIGestureRecognizerStatePossible to UIGestureRecognizerStateFailed or UIGestureRecognizerStateRecognized. Recognizers for continuous gesture transition from UIGestureRecognizerStatePossible to these phases in the given order: UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, and UIGestureRecognizerStateEnded. If, however, they receive a cancellation touch, they should transition to UIGestureRecognizerStateCancelled. If recognizers for continuous gestures can’t interpret a multi-touch sequence as their gesture, they transition to UIGestureRecognizerStateFailed.

See Also

Getting the Recognizer’s State and View

view

The view the gesture recognizer is attached to.

enabled

A Boolean property that indicates whether the gesture recognizer is enabled.

buttonMask

A bit mask of the button (or buttons) in the gesture represented by the receiver.

modifierFlags

The bit mask of modifier flags in the gesture represented by the receiver.