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 ...
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.