Instance Method


Tells the responder when a system event (such as a system alert) cancels a touch sequence.


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



A set of UITouch instances that represent the touches for the ending phase of the event represented by event. For touches in a view, this set contains only one touch by default. To receive multiple touches, you must set the view's isMultipleTouchEnabled property to true.


The event to which the touches belong.


UIKit calls this method when it receives a system interruption requiring cancellation of the touch sequence. An interruption is anything that causes the application to become inactive or causes the view handling the touch events to be removed from its window. Your implementation of this method should clean up any state associated with handling the touch sequence. The default implementation of this method forwards the message up the responder chain. When creating your own subclasses, call super to forward any events that you do not handle yourself. For example,

[super touchesCancelled:touches withEvent:event];

If you override this method without calling super (a common use pattern), you must also override the other methods for handling touch events, if only as stub (empty) implementations.

See Also

Responding to Touch Events

func touchesBegan(Set<UITouch>, with: UIEvent?)

Tells this object that one or more new touches occurred in a view or window.

func touchesMoved(Set<UITouch>, with: UIEvent?)

Tells the responder when one or more touches associated with an event changed.

func touchesEnded(Set<UITouch>, with: UIEvent?)

Tells the responder when one or more fingers are raised from a view or window.

func touchesEstimatedPropertiesUpdated(Set<UITouch>)

Tells the responder that updated values were received for previously estimated properties or that an update is no longer expected.