Class

NSTouch

A snapshot of a particular touch at an instant in time.

Declaration

@interface NSTouch : NSObject

Overview

A touch event is not persistent throughout the touch. A touch creates new instances as it progresses. Use the identity property to follow a specific touch across its lifetime.

Touches do not have a corresponding screen location. The first touch of a touch collection latches to the view underlying the cursor using the same hit detection as mouse events. Additional touches on the same device latch to the same view. Latches remain on views until the user ends a touch or an event cancels it.

Topics

Getting the Touch Type

type

A type of touch from a Touch Bar interaction.

NSTouchType

A bit mask identifying a direct or indirect touch type.

NSTouchTypeMask

A bit mask identifying a direct or indirect touch type.

Using Touch Properties

identity

The changes to a particular touch during its lifetime.

phase

The current phase of the touch.

NSTouchPhase

The possible phases of a touch.

normalizedPosition

The normalized position of the touch.

resting

The indicator for a resting touch.

Using Touch Device Properties

device

The digitizer that generates the touch. Useful to distinguish touches emanating from multiple-device scenarios.

deviceSize

The range of the touch device in points, such as 72 ppi.

Getting the Touch Location

- locationInView:

Indicates the location of the touch in the view's coordinates.

- previousLocationInView:

Indicates the previous location of the touch in the view's coordinates.

Relationships

Inherits From

Conforms To

See Also

Mouse, Keyboard, and Touch Events

NSEvent

An object that contains information about an input action, such as a mouse click or a key press.