Recipe: Retrieving Transform Information

Affine transforms enable you to change an object’s geometry by mapping that object from one view coordinate system into another. The iOS SDK fully supports standard affine 2D transforms. With them, you can scale, translate, rotate, and skew your views however your heart desires and your application demands.

Transforms are defined in Core Graphics and consist of calls such as CGAffineTransformMakeRotation() and CGAffineTransformScale(). These build and modify 3-by-3 transform matrices. After these are built, use UIView’s transform property to assign 2D affine transformations to UIView objects.

For example, you might apply a rotation transform directly. This removes any existing transform and replaces it ...

Get The Core iOS Developer’s Cookbook, Fifth 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.