Instance Method

touchesEnded(_:with:)

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

Declaration

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

Parameters

touches

A set of UITouch instances that represent the touches for the ending phase of the event represented by event.

event

An object representing the event to which the touches belong.

Discussion

The default implementation of this method does nothing. However immediate UIKit subclasses of UIResponder, particularly UIView, forward the message up the responder chain. To forward the message to the next responder, send the message to super (the superclass implementation); do not send the message directly to the next responder. For example,

[super touchesEnded:touches withEvent:event];

When an object receives a touchesEnded:withEvent: message it should clean up any state information that was established in its touchesBegan(_:with:) implementation.

Multiple touches are disabled by default. In order to receive multiple touch events you must set the a isMultipleTouchEnabled property of the corresponding view instance to true.

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.