ZZomato·BehavioralL3DSA Round

Difference Between Frame and Bounds in iOS

viaGlassdoor

Question: What is the difference between frame and bounds on a UIView in iOS?

Answer framing: frame describes a view's position and size in its superview's coordinate system (origin relative to the parent). bounds describes the view's position and size in its own coordinate system (origin is typically (0,0) unless content is scrolled/transformed). Changing a view's transform affects frame but leaves bounds unchanged; conversely, changing bounds.size resizes the view without necessarily moving it relative to its own coordinate space. This distinction matters most when applying rotations/scales or working with scroll views.

Add a follow-up question they asked
No follow-ups yet. Be the first to add one.
asked …
LeaderboardSalary
Language
Account