<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGestureRecognizer/touchesCancelled(_:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIGestureRecognizer(im)touchesCancelled:withEvent:"
  },
  "title" : "touchesCancelled(_:with:)"
}
-->

# touchesCancelled(_:with:)

Sent to the gesture recognizer when a system event (such as an incoming phone call) cancels a touch event.

```
func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent)
```

## Parameters

`touches`

A set of [`UITouch`](/documentation/UIKit/UITouch) instances in the event represented by `event` that represent the touches in the [`UITouch.Phase.cancelled`](/documentation/UIKit/UITouch/Phase-swift.enum/cancelled) phase.

`event`

A [`UIEvent`](/documentation/UIKit/UIEvent) object representing the event to which the touches belong.

## Discussion

This method has the same exact signature as the corresponding one declared by [`UIResponder`](/documentation/UIKit/UIResponder). Through this method a gesture recognizer receives touch objects (in their [`UITouch.Phase.cancelled`](/documentation/UIKit/UITouch/Phase-swift.enum/cancelled) phase) before the view attached to the gesture recognizer receives them. `UIGestureRecognizer` objects are not in the responder chain, yet observe touches hit-tested to their view and their view’s subviews. After observation, the delivery of touch objects to the attached view, or their disposition otherwise, is affected by the [`cancelsTouchesInView`](/documentation/UIKit/UIGestureRecognizer/cancelsTouchesInView), [`delaysTouchesBegan`](/documentation/UIKit/UIGestureRecognizer/delaysTouchesBegan), and [`delaysTouchesEnded`](/documentation/UIKit/UIGestureRecognizer/delaysTouchesEnded) properties.

Upon receiving this message, the gesture recognizer for a continuous gesture should set its state to [`UIGestureRecognizer.State.cancelled`](/documentation/UIKit/UIGestureRecognizer/State-swift.enum/cancelled); a gesture recognizer for a discrete gesture should set its state to [`UIGestureRecognizer.State.failed`](/documentation/UIKit/UIGestureRecognizer/State-swift.enum/failed).

---

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)