Attaching Gesture Recognizers to UIKit Controls

Learn how gesture recognizers interact with UIKit controls such as buttons switches and sliders.


Gesture recognizers attached to your views do not impact the ability of UIKit controls to handle events. Events occurring within the bounds of a control are handled by the control first, giving the control a chance to call its action method. Specifically, UIKit controls call their action method in the following situations:

To handle any of the preceding gestures before the control calls its action method, install your gesture recognizer on the control itself. Gesture recognizers handle touch events before the views to which they are attached. As a result, installing a gesture recognizer directly on a control prevents that control from calling its action method.

See Also

Simultaneous Gestures

Preferring One Gesture Over Another

Use a gesture recognizer delegate object to determine the order in which gestures are recognized in your views.

Allowing the Simultaneous Recognition of Multiple Gestures

Learn how to use a delegate object to allow detection of more than one gesture at a time.