Let me try to explain it. Please tell me if I am wrong. I am just 70% sure about it.
Like I understand it, an UIView has a frame and an bounds rectangle. The job of the frame rectangle is to set the position of the UIView relative to it's superview. More precisely: Relative to the coordinate system of the superview. The job of the bounds rectangle is to set the drawing area of the UIView, relative to it's own coordinate system.
Briefly:
Are there any mistakes or important things I missed?
Frame is used by the view's parent view to place it inside the parent view. Bounds is used by the view itself to place it's own content (like a scroll view does while scrolling).
The frame rectangle, which describes the view's location and size in its superview's coordinate system.
Short description. frame = a view's location and size using the parent view's coordinate system (important for placing the view in the parent) bounds = a view's location and size using its own coordinate system (important for placing the view's content or subviews within itself)
TLDR: Bounds refers to the views own coordinate system while Frame refers to the views parent coordinate system.
Check out Apple's guide on View Geometry. They have pretty good examples on what happens when you change bounds and frame values.
A view's Frame: the position and size of a rectangle inside the superview where the view will fill.
A view's Bound: the position and size of a rectangle inside the view itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With