frame vs. bounds
Question
What’s the difference between the
frameand thebounds?
Short interview answer
A view’s frame describes its size and location in its superview’s coordinate system. Its bounds describe its size and internal coordinate system.
Detailed answer
For a 100-by-40 view placed at x=20, y=30 in its parent, Frame is (20, 30, 100, 40) while Bounds is normally (0, 0, 100, 40): the former uses the parent’s coordinates, the latter uses the view’s own coordinates. Use Auto Layout for normal adaptive positioning. Frame is not reliable with a non-identity transform; UIKit documents using center and bounds instead in that case.