Changes

Jump to: navigation, search

Identifying Gestures using iOS 8 Gesture Recognizers

38 bytes added, 04:32, 10 November 2016
Discrete and Continuous Gestures
Prior to iOS 4, the identification of a gesture was the responsibility of the application developer and typically involved the creation of complex mathematical algorithms. In recognition of this complexity, and given the importance of gestures to user interaction with the iOS device, Apple introduced the UIGestureRecognizer class in iOS 4 thereby making the task of identifying the types of gestures a much easier task for the application developer.
The goal of this chapter, therefore, is to provide an overview of gesture recognition within the context of iOS 10. The next chapter will work through [[An iOS 8 Swift Gesture Recognition Tutorial|An iOS 10 Gesture Recognition Tutorial]].
== The UIGestureRecognizer Class ==
The UIGestureRecognizer class is used as the basis for a collection of subclasses, each designed to detect a specific type of gesture. These subclasses are as follows:
• '''UITapGestureRecognizer''' – This class is designed to detect when a user taps on the screen of the device. Both single and multiple taps may be detected based on the configuration of the class instance.
• '''UIPinchGestureRecognizer''' – Detects when a pinching motion is made by the user on the screen. This motion is typically used to zoom in or out of a view or to change the size of a visual component.
<htmlet>ios10</htmlet>
== Discrete and Continuous Gestures ==
<htmlet>adsdaqbox_flow</htmlet>
Gestures fall into two distinct categories – discrete and continuous. A discrete gesture results in only a single call being made to the corresponding action method. Tap gestures (including multiple taps) are considered to be discrete because they only trigger the action method once. Gestures such as swipes, pans, rotations and pinches are deemed to be continuous in that they trigger a constant stream of calls to the corresponding action methods until the gesture ends.

Navigation menu