Transforming the Image View

Now that we see what affine transforms offer us, the properties and methods exposed by the gesture recognizers start to make more sense. The pinch gesture recognizer provides a scale that we could use to make a scale transform, and the pan recognizer offers translationInView that will be perfect for making a translation.

To make use of these transforms, we have a few options. UIView has a transform property, so we can set that directly. The underlying CALayer that provides the view’s appearance also has a transform property, although that one is of type CATransform3D and works in three dimensions. A more advanced option would be to write our own subclass of UIView or CALayer that draws its own contents; the Core ...

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.