UICollectionView Cell + UiLabel with AutoLayout

后端 未结 6 752
醉酒成梦
醉酒成梦 2020-12-29 08:14

I\'m trying to pin an UILabel to it\'s parent cell. I added four constraints (top, leading, trailing, bottom) which works fine on iOS 8.0 but not on iOS 7.X

6条回答
  •  伪装坚强ぢ
    2020-12-29 08:51

    UIView:0x798ae5d0 is the contentView of the CollectionViewCell. Somehow at a certain moment it uses the UICollectionViewCells defaultSize, which is (50.0, 50.0).

    
    

    As your horizontal margins 8 + 43 = 51 are bigger than the contentView (50) it is impossible to satisfy the layout.

    
    
    

    One can make the layout more flexible, so that it also works on a (50.0, 50.0) size. In your case by changing equal 43 to <= 43 or by reducing a priority of 1000 to 750 or 999.

提交回复
热议问题