0

I want to add a UIlabel at the bottom of a custom collectionViewCell. I added the label through interface builder and added a bottom constraint equal to 0.0 and a leading constraint equal to 20.0. In interface builder the height of the cell is 300.0 the same height I am using for iPad portrait when I created the constraint. Until now every thing is working fine. The problem is in iPad landscape where the label shows up in the middle of the cell and not at the bottom. The height of the cell on ipad landscape is 600.0. If I set the size of the cell in interface builder to 600 and then create the constraints, the labels shows up also at the bottom of the cell.

enter image description here

I am expecting label 2 to be always at this position, depending of the cell size. However, this happen only if the cell size if equal to the cell in interface builder. otherwise the label has another position or did not even appear on the cell.

user567
  • 3,712
  • 9
  • 47
  • 80
  • 1
    Are you sure that the label itself is moving and not just the label's height changes, which causes the content of the label to appear further from the bottom of the cell? Also if you could include a screenshot of your constraints and the expected and actual UI layout, it would help answering your question. – Dávid Pásztor Aug 23 '17 at 15:44
  • I updated my question – user567 Aug 23 '17 at 15:48
  • That doesn't actually show any of the three pieces of information I asked for. It only shows a screenshot of your InterfaceBuilder. When I meant screenshot of the constraints, I meant opening the Size Inspector in Interface Builder and taking a screenshot of the Constraints window. And the expected/actual UI layout I meant a screenshot of the actual layout on the device. – Dávid Pásztor Aug 23 '17 at 15:57
  • I was overriding layoutsubviews() without calling super.layoutsubview(), that was the problem – user567 Aug 24 '17 at 07:35

0 Answers0