Instance Method

addGestureRecognizer(_:)

Attaches a gesture recognizer to the view.

Declaration

func addGestureRecognizer(_ gestureRecognizer: UIGestureRecognizer)

Parameters

gestureRecognizer

An object whose class descends from the UIGestureRecognizer class. This parameter must not be nil.

Discussion

Attaching a gesture recognizer to a view defines the scope of the represented gesture, causing it to receive touches hit-tested to that view and all of its subviews. The view establishes a strong reference to the gesture recognizer.

See Also

Managing Gesture Recognizers

func removeGestureRecognizer(UIGestureRecognizer)

Detaches a gesture recognizer from the receiving view.

var gestureRecognizers: [UIGestureRecognizer]?

The gesture-recognizer objects currently attached to the view.

func gestureRecognizerShouldBegin(UIGestureRecognizer)

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