Is there a reason why the bounds property of UIView
(an NSView
) are a CGRect
when the only information you'll ever want in that property are the size of that CGRect
.
Is it just a shortcut for drawing since you'll need a CGRect
when drawing? Or just a very specific special case where the origin
of the bounds
could be something else than {0, 0}
?
The frame
specifies where the view is relative to the superview, while bounds
specifies where the view is allowed to draw relative to the frame.
By changing the bounds
origin and/or width you can get clipping, e.g., or drawing outside of the view.
I.e, bounds origin is normally (0,0) but it must not be always so, like when you do clipping.
Furthermore, bounds
is used by affine transformations instead of the frame
and it represents the position after transformation which could also have an origin different from (0,0);
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