I have a label that is set to resize to its content. I want the UICollectionViewCell to do the same. I cannot find anyway to implement that.
A picture describing my current arrangement can be found below:
I have a label that is set to resize to its content. I want the UICollectionViewCell to do the same. I cannot find anyway to implement that.
A picture describing my current arrangement can be found below:
Use "Autolayout" in cell's Interface Builder document. After setting constraints, your cell frame is going to dynamically change.![enter image description here](https://i.stack.imgur.com/edJOQ.png)
configure collection:
and in cell add label constraints (top and bottom)
I think you'll want to implement the UICollectionViewDelegateFlowLayout method collectionView:layout:sizeForItemAtIndexPath: to adjust the size of each collection item based on the contents.
Here's a tutorial on Collection Views that covers this specific topic.