I have an UICollectionViewCell that contains UIImageView and two UIViews with label in each (views are semi-transparent backgrounds):
[img]https://i.stack.imgur.com/k3EhQ.png
I want them to be aligned vertically in the cell. Top space of UIView#1 should be equal to bottom space of UIView#2. The problem is that labels can contain long strings so they might span to 2 or 3 lines. Examples of possible states:
- Both labels have only 1 line
- Both labels contain 2 lines
- Top label contains 2 lines and bottom one contains 1 line
- Top label contains 3 lines and bottom one contains 1 line etc.
When label grows its container (UIView#1 or UIView#2) should grow as well but two views as a group should still be vertically aligned:
[img]https://i.stack.imgur.com/BdIZW.png
[img]https://i.stack.imgur.com/hrGwk.png
I tried to embed them in another UIView but I can't set up valid constraints (I believe it is possible to solve this using auto layout only).
[img]https://i.stack.imgur.com/Hv1Na.png
Can somebody help me?