23. Gesture Recognizers
What if an app needed a quick and easy way to handle taps, swipes, pinches, and rotations? Back in the Dark Ages (before the iPad was released), a developer had to subclass UIView
, implement the touchesBegan:
/touchesMoved:
/touchesEnded:
methods, and write custom logic to determine when any of these actions was taking place. It could take all day!
Apple introduced gesture recognizers to address this need with iOS 3.2 when the original iPad was released. UIGestureRecognizer
is an abstract class that puts a common architecture around handling gestures. There are several concrete implementations to handle the everyday gestures that are commonly used, and even subclassing guidelines to create your own gestures using the same ...
Get Mastering iOS Frameworks: Beyond the Basics, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.