Q:

When does UIViewAutoresizing flexible Height+Top or Height+Bottom ever make sense? What does it do?

What is the auto resizing behavior of a UIView that has UIViewAutoresizing Height+Top or Height+Bottom? Does this ever make sense? Does one of the margins or the view itself get precedence? I just discovered I had accidentally set a view's UIViewAutoresizing to UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin, and that caused the view to resize to a 0 height when its parent resized.

A:

This is how autoresizing works:
Say the parent view has 400 height, and your view is set on y = 100, height = 200
That means, there's 100 pixels above your view, 200 pixels for your view, and 100 pixels below your view.
With flexibleHeight and flexibleTop, it means that when the parent view frame changes, it will maintain the bottom 100 pixels fixed, and split the remainder proportionally between the top margin and height
So, if you go from 400 height to 300 height on the parent, it means it will use 100 for the bottom margin and split the remainder 200 proportionally, leaving your y = 66.666 and height = 133.333
If you go from 400 height to 100 height, it will still use those 100 for the bottom margin, leaving 0 space for top margin and height, leaving your y = 0, height = 0

