Instance Method

endTracking(_:with:)

Called when a touch event associated with the control ends.

Declaration

func endTracking(_ touch: UITouch?, with event: UIEvent?)

Parameters

touch

The touch object containing the final touch information.

event

The event object containing the touch event.

Discussion

This method is called at the end of a sequence of touch events inside the control’s bounds. Subclasses can override this method and use it to perform any actions relevant to the completion of the touch sequence. You should also use it to perform any cleanup associated with tracking the event.

If you override this method, you must call super at some point in your implementation. The default implementation updates the isTracking property of the control.

See Also

Tracking Touches and Redrawing Controls

func beginTracking(UITouch, with: UIEvent?) -> Bool

Called when a touch event enters the control’s bounds.

func continueTracking(UITouch, with: UIEvent?) -> Bool

Called when a touch event associated with the control is updated.

func cancelTracking(with: UIEvent?)

Tells the control to cancel tracking related to the given event.

var isTracking: Bool

A Boolean value indicating whether the control is currently tracking touch events.

var isTouchInside: Bool

A Boolean value indicating whether a tracked touch event is currently inside the control’s bounds.