gestureRecognizerShouldBegin(_:)
Asks the view if the gesture recognizer should continue tracking touch events.
Declaration
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> BoolParameters
- gestureRecognizer:
The gesture recognizer that’s attempting to transition out of the Possible state.
Return Value
true if the gesture recognizer should continue tracking touch events and use them to trigger a gesture or false if it should transition to the UIGestureRecognizer.State.failed 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 UIGestureRecognizer.State.possible state and thinks it has the events needed to move to the UIGestureRecognizer.State.began state.
The default implementation of this method returns true.