Class

UITapGestureRecognizer

A discrete gesture recognizer that interprets single or multiple taps.

Declaration

@interface UITapGestureRecognizer : UIGestureRecognizer

Overview

UITapGestureRecognizer is a concrete subclass of UIGestureRecognizer.

For gesture recognition, the specified number of fingers must tap the view a specified number of times. Although taps are discrete gestures, they are discrete for each state of the gesture recognizer. The system sends the associated action message when the gesture begins and then again for each intermediate state until (and including) the ending state of the gesture. Code that handles tap gestures should test for the state of the gesture, for example:

- (void)handleTap:(UITapGestureRecognizer *)sender
{
    if (sender.state == UIGestureRecognizerStateEnded)
    {
        // handling code
    }
}

Action methods handling this gesture can get the location of the gesture as a whole by calling the UIGestureRecognizer method locationInView:. If there are multiple taps, this location is the first tap. If there are multiple touches, this location is the centroid of all fingers tapping the view. Clients can get the location of particular touches in the tap by calling locationOfTouch:inView:. If multiple taps are allowed, this location is the first tap.

Topics

Configuring the Gesture

buttonMaskRequired

The bit mask of the buttons the user must press for gesture recognition.

numberOfTapsRequired

The number of taps necessary for gesture recognition.

numberOfTouchesRequired

The number of fingers that the user must tap for gesture recognition.

Relationships

Inherits From

See Also

Standard Gestures

Handling UIKit Gestures

Use gesture recognizers to simplify touch handling and create a consistent user experience.

Coordinating Multiple Gesture Recognizers

Discover how to use multiple gesture recognizers on the same view.

UIHoverGestureRecognizer

A discrete gesture recognizer that interprets pointer movement over a view.

UILongPressGestureRecognizer

A discrete gesture recognizer that interprets long-press gestures.

UIPanGestureRecognizer

A discrete gesture recognizer that interprets panning gestures.

UIPinchGestureRecognizer

A discrete gesture recognizer that interprets pinching gestures involving two touches.

UIRotationGestureRecognizer

A discrete gesture recognizer that interprets rotation gestures involving two touches.

UIScreenEdgePanGestureRecognizer

A discrete gesture recognizer that interprets panning gestures that start near an edge of the screen.

UISwipeGestureRecognizer

A discrete gesture recognizer that interprets swiping gestures in one or more directions.