A discrete gesture recognizer that interprets single or multiple taps.
- iOS 3.2+
- Mac Catalyst 13.0+
- tvOS 9.0+
UITap is a concrete subclass of
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:
Action methods handling this gesture can get the location of the gesture as a whole by calling the
location. 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
location. If multiple taps are allowed, this location is the first tap.