Daily iOS
UIKit

frame vs bounds

While debugging a custom UIKit view you notice bounds.origin isn't (0, 0). What's the difference between frame and bounds?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

frame is the view's position and size in its superview's coordinate system; bounds is its origin and size in its own coordinate system. Both are CGRects, but they're measured against different coordinate systems.

Share a question