An NSPressGestureRecognizer object is a discrete gesture recognizer that tracks whether the user held a mouse button down for a minimum amount of time before releasing it. Use a press gesture recognizer to configure which button must be held and the amount of time for which it must be held. You can also specify how far the mouse is allowed to move and still be considered a valid gesture.


Upon creation, the gesture recognizer is configured to recognize press gestures involving only the primary button. It also delays sending primary button events to the view by setting the delaysPrimaryMouseButtonEvents property to true. To change the set of buttons to track, modify the buttonMask property.


Configuring the Gesture Recognizer

var buttonMask: Int

A bit mask of the button (or buttons) required to recognize this press.

var minimumPressDuration: TimeInterval

The minimum time (in seconds) that the mouse button must be held down in the view for the gesture to be recognized.

var allowableMovement: CGFloat

The maximum movement of the mouse in the view before the gesture fails.

Instance Properties

var numberOfTouchesRequired: Int

The number of touches required in an NSTouchBar object for the gesture recognizer to match.


Inherits From