I am now quite comfortable using autosizing masks in IB but there are two autosizing setting that I am not clear how they are intended to differ:
Setting 1
Autosizing with both upper and lower anchors http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-0.png
Setting 2
Autosizing with only uppper anchor http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-1.png
Some context. The UIView subclass that uses these settings is a child subview. Setting 1 is giving me the behavior I want - subview expands/contracts with its parent view - while setting 2 is slightly different in a non-obvious way.
What is the intended layout difference between these two settings?
Thanks,
Doug
Setting 1: The view will resize vertically so that both the distance from the top of the superview and the distance from the bottom of the superview are preserved. Basically, the view will grow and shrink in tandem with the superview; if the superview gets taller by 30 pixels, so will this view.
Setting 2: The view will resize vertically so that the distance from the top of the superview is preserved, and the proportional height of the view is preserved. Basically, the view will grow proportionally with the the superview; if the superview gets taller by 10%, this view will also get taller by 10%.
Note how these differ in practice. Assume the superview is 100px tall, and the subview is 60px tall, with a 20px buffer on the top and bottom. Now let's resize the superview to 150px tall.
In general, you usually want the behavior in Setting 1. You might use Setting 2 if you had a master/detail view split top/bottom, and you wanted both sections to grow proportionally with the superview. In that case, you would give both views flexible height, fixing the top margin of the top view and the bottom margin of the bottom view.
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