Wednesday, 7 August 2013

How to resize superview to fit all subviews with autolayout?

How to resize superview to fit all subviews with autolayout?

My understanding of autolayout is that it takes the size of superview and
base on constrains and intrinsic sizes it calculates positions of
subviews.
Is there a way to reverse this process? I want to resize superview on the
base of constrains and intrinsic sizes. What is the simplest way of
achieving this?
I have view designed in xcode which I use as a header for UITableView.
This view includes a label and a button. Size of the label differs
depending on data. Depending on constrains the label successfully pushes
the button down or if there is a constrain between the button and bottom
of superview the label is compressed.
I have found a few similar questions but they don't have good and easy
answers.

No comments:

Post a Comment