I created an UICollectionViewCell (.xib) and I just wanted to add a label and some simple constraints there, as such:
However, doing this messes up everything. No matter the size I chose on UICollectionViewDelegateFlowLayout
, the cell will always use the size of the label! What am I doing wrong here? Am I supposed to not use constraints on CollectionViewItems and instead translatesMaskIntoConstraints = true
?
Thanks!
And here's what I actually have (as soon as I add the constraints):
edit2: Fixed! By changing the label's content hugging priority to 10 (for example, or lower). But...why exactly if there are no other constraints in the view? If somebody can answer it, I would be very grateful, cause I could just answer this question and give this solution but I can't explain why exactly it fixed it, so it's not a proper answer anyway.