Reputation: 4858
Attached image shows Whatever I want..
From image, you can see that B and C are subviews of A (Dark blue border indicated view A). B is having aspect ratio (B's height would be based on its width). C will have fixed height.
I want such a combination of constraints so that, height of A should be based their subview's calculation.
Upvotes: 0
Views: 413
Reputation: 2640
Below are the constraints set for view hieararchy:
For View A :
For View B :
For View C:
Also you can set View B's constraint like this way if you don't want square always:
Upvotes: 2
Reputation: 27448
You constraints should be like,
View A,
leading, Trailing, Top
View B,
leading, trailing, top, bottom and aspect ratio
View C,
leading, trailing, bottom and fix height
Hope this will help :)
Upvotes: 1
Reputation: 1382
Here is what constraints you need:
For View A:
For View B:
For View C:
Upvotes: 2