Pinching and Panning

How can we play with images on iOS? The whole point of a touch interface is to provide the feeling of interacting directly with our data, so we should be thinking of moving the image around with a drag, zooming in and out of it with pinch gestures, and so forth.

Let’s take a look at what gesture recognizers give us. Here’s a table summarizing the concrete subclasses of UIGestureRecognizer and the important properties and/or methods exposed by each:

ClassImportant Properties and Methods

UILongPressGestureRecognizer

minimumPressDuration, allowableMovement

UIPanGestureRecognizer

translationInView:, velocityInView:

UIPinchGestureRecognizer

scale, velocity

UIRotationGestureRecognizer

rotation, velocity

UIScreenEdgePanGestureRecognizer ...

Get iOS 9 SDK Development 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.