<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGestureRecognizer/ignore(_:for:)-8qqor",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGestureRecognizer(im)ignorePress:forEvent:"
  },
  "title" : "ignore(_:for:)"
}
-->

# ignore(_:for:)

Tells the gesture recognizer to ignore a specific press of the given event.

```
@MainActor func ignore(_ button: UIPress, for event: UIPressesEvent)
```

## Parameters

`button`

A [`UIButton`](/documentation/UIKit/UIButton) object that is part of the current button press event and associated with `event`.

`event`

A [`UIEvent`](/documentation/UIKit/UIEvent) object that includes a reference to `touch`.

## Discussion

If a button press isn’t part of this gesture you may pass it to this method, causing it to be ignored. `UIGestureRecognizer` does not cancel ignored presses on the associated view even if [`cancelsTouchesInView`](/documentation/UIKit/UIGestureRecognizer/cancelsTouchesInView) is <doc://com.apple.documentation/documentation/Swift/true>. This method is intended to be called, not overridden.

---

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)