Instance Method

gestureRecognizerShouldBegin:

Asks the view if the gesture recognizer should be allowed to continue tracking touch events.

Declaration

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer;

Parameters

gestureRecognizer

The gesture recognizer that is attempting to transition out of the UIGestureRecognizerStatePossible state.

Return Value

YES if the gesture recognizer should continue tracking touch events and use them to trigger a gesture or NO if it should transition to the UIGestureRecognizerStateFailed state.

Discussion

Subclasses may override this method and use it to prevent the recognition of particular gestures. For example, the UISlider class uses this method to prevent swipes parallel to the slider’s travel direction and that start in the thumb.

At the time this method is called, the gesture recognizer is in the UIGestureRecognizerStatePossible state and thinks it has the events needed to move to the UIGestureRecognizerStateBegan state.

The default implementation of this method returns YES.

See Also

Managing Gesture Recognizers

- addGestureRecognizer:

Attaches a gesture recognizer to the view.

- removeGestureRecognizer:

Detaches a gesture recognizer from the receiving view.

gestureRecognizers

The gesture-recognizer objects currently attached to the view.