Other Geometric Elements
As you’ve seen, it’s convenient to use a view’s origin and size as well as its center property, which allows you to work more natively with Core Graphics calls. You can build on this idea to expose other properties of the view, including its width and height, as well as basic geometry, such as its left, right, top, and bottom points. In some ways, this breaks Apple’s design philosophy. It exposes items that normally fall into structures without reflecting the structures. At the same time, it can be argued that these elements are true view properties. They reflect fundamental view characteristics and deserve to be exposed as properties.
Recipe 4-4 provides a full view frame utility category for UIView, which lets you make ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access