Gesture Recognizers

The first versions of the iPhone SDK gave us only low-level raw touch data via the UIView methods touchesBegan, touchesMoved, touchesEnded, and touchesCancelled. These delivered sets of UITouch events, and from the raw geometry and timing of these events, we could track events like swipes, using logic like “if the touch moved at least 50 points up, and not more than 20 points to either side, in less than 0.5 seconds, then treat it as an upward swipe.”

As one might expect, this was a huge pain in the butt to implement and led to variations in user experience as different developers interpreted the touch data differently, based on what “felt right” to them.

Fortunately, the situation was cleaned up in later versions of iOS ...

Get iOS 8 SDK Development, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.