I know that if you want to resize a UIView
you have to do it like so:
CGRect frame = view.frame;
frame.size.height -= 100;
view.frame = frame;
instead of just:
view.frame.size.height -= 100;
My question is what could be the logic behind this? Is the setter for frame
doing something extra, like maybe call setNeedsDisplay
?
Basically the reason behind it that the following line
actually does the following 2 things:
[view frame]
method that returnsCGRect
structure - copy of what is stored in your viewheight
field of the copy - so it does not affect the value of the structure stored in the viewActually yes - view's
frame
property is calculated based on its origin, bounds and transform so setting the frame will also affect its origin and bounds (and depending on view's contentMode may force the view to redraw)