I'm using a UICollectionViewCompositionalLayout
with estimated cell heights and simple UICollectionViewCell
items that contain a UILabel
. I'm using the common self-sizing AutoLayout pattern with the label anchored to the top and bottom of the contentView
.
The collectionView renders correctly when the controller is presented, but when I scroll to the bottom and then scroll back up, the UILabel is collapsed, leaving what looks like a 1px sliver of content. Momentarily swiping up to the home screen and canceling the gesture causes the cell heights to snap to the correct values.
I've tried calling layoutIfNeeded
before cells are returned. I've checked prepareForReuse
and my AutoLayout code. I've fiddled with various UILabel compression and content hugging priorities and nothing seems to change this behavior.
Anyone experience anything similar or have a suggestion for a fix?