Adjusting Sizes
In the simplest usage patterns, a view’s frame and bounds control its size. A frame, as you’ve already seen, defines the location of a view in its parent’s coordinate system. If the frame’s origin is set to (0.0, 30.0), the view appears in the superview flush with the left side of the view and offset 30 points from the top. On non-Retina displays, this corresponds to 30 pixels down; on Retina displays, it is 60 pixels down.
Bounds define a view within its own coordinate system. Therefore, the origin for a view’s bounds (that is, myView.bounds) is normally (0.0, 0.0). For most views, the size matches the normal extent—that is, the frame’s size property. (This isn’t always true for some classes, like UIScrollView, whose extent may ...
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