UdayM
UdayM

Reputation: 1783

UILabel in UICollectionViewCell

I designed UICollectionViewCell in storyboard .Consists 2 elements UILabel, UIImageView.

for UILabel i given constrains leading=0, trailing=0, bottom=0, height=100

My collectionViewCell enter image description here

But when i run in simulator: enter image description here

Edit: when i observed in interface inspector, label is not attached to view on collectionView: enter image description here

Upvotes: 2

Views: 181

Answers (1)

UdayM
UdayM

Reputation: 1783

I solved issue by adding these lines in cellForItemAtIndexPath

[cell setNeedsLayout];
[cell layoutIfNeeded];

Upvotes: 1

Related Questions