A gesture recognizer that looks for a touch event occurring and ending in approximately the same area on the screen.
- watchOS 3.0+
The tap gesture recognizer can report when a single tap happens or when multiple taps happen.
You do not create instances of this class programmatically. Instead, add a tap gesture recognizer to your Watch app’s storyboard file, dropping it onto a specific interface object. Touches occurring within the bounds of that interface object are tracked by the gesture recognizer and reported to an action method you define on the parent interface controller. For information on defining your action method and connecting it to your gesture recognizer, see
State Changes for a Tap Gesture
A tap gesture recognizer tracks discrete events, and therefore has a limited number of state changes. Each tap in a tap gesture comprises the user touching the screen and then lifting the finger off the screen in roughly the same location and within a preset amount of time. The tap gesture is recognized when the user performs the specified number of taps. The state transition sequences for a tap gesture are as follows:
Possible —> Recognized
Possible —> Failed
The gesture recognizer calls its action method when it enters the WKGestureRecognizerState.recognized state. You may determine the location where the tap occurred by calling its
location method. For more information on implementing discrete gesture recognizers, see
Interface Builder Attributes
Xcode lets you configure information about your gesture recognizer in your storyboard file. Table 1 lists the attributes you can configure in your storyboard and their meaning.
The number of taps needed to complete the gesture. You can set this value programmatically using the