<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITapGestureRecognizer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITapGestureRecognizer"
  },
  "title" : "UITapGestureRecognizer"
}
-->

# UITapGestureRecognizer

A discrete gesture recognizer that interprets single or multiple taps.

```
@MainActor class UITapGestureRecognizer
```

## Overview

[`UITapGestureRecognizer`](/documentation/UIKit/UITapGestureRecognizer) is a concrete subclass of [`UIGestureRecognizer`](/documentation/UIKit/UIGestureRecognizer).

For gesture recognition, the specified number of fingers must tap the view a specified number of times. Although taps are discrete gestures, they’re 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:

```objc
- (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`](/documentation/UIKit/UIGestureRecognizer) method [`location(in:)`](/documentation/UIKit/UIGestureRecognizer/location(in:)). 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(ofTouch:in:)`](/documentation/UIKit/UIGestureRecognizer/location(ofTouch:in:)). If multiple taps are allowed, this location is the first tap.

## Topics

### Configuring the gesture

[`buttonMaskRequired`](/documentation/UIKit/UITapGestureRecognizer/buttonMaskRequired)

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

[`numberOfTapsRequired`](/documentation/UIKit/UITapGestureRecognizer/numberOfTapsRequired)

The number of taps necessary for gesture recognition.

[`numberOfTouchesRequired`](/documentation/UIKit/UITapGestureRecognizer/numberOfTouchesRequired)

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



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)