0

I have an UICollectionViewCell that contains UIImageView and two UIViews with label in each (views are semi-transparent backgrounds):

[img]http://i.imgur.com/y1teAHW.png[/img]

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:

  1. Both labels have only 1 line
  2. Both labels contain 2 lines
  3. Top label contains 2 lines and bottom one contains 1 line
  4. 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]http://i.imgur.com/ANvcyNK.png[/img]

[img]http://i.imgur.com/qf1hUdS.png[/img]

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]http://i.imgur.com/Um6CFm5.png[/img]

Can somebody help me?

Cahir09
  • 501
  • 6
  • 14

0 Answers0