I have a UICollectionViewCell subclass that\'s setup with a prototype cell and constraints (every view is connected both vertically and horizontally).
I have two la
flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize flowLayout.itemSize = UICollectionViewFlowLayoutAutomaticSize
Of course I am familiar with Apple's repeated claims that a UICollectionViewCell in a UICollectionViewFlowLayout can be self-sizing based on internal constraints. But I have never seen working code from Apple that demonstrated this feature, and I have never once myself succeeded in confirming those claims to be true. I do not believe there is really such a thing as a self-sizing cell. For years, trying to get a cell to be self-sizing resulted in crashes. In iOS 10, the crashing mostly stopped, but now the flow layout was not laying out the cells correctly (which sounds like what you're seeing).
Naturally, I have filed bugs on all this, year after year.
Meanwhile, what I do is to give the collection view a delegate and implement collectionView(_:layout:sizeForItemAt:)
, and I suggest that you should do the same.
EDIT New in iOS 13 you can use a composable layout and abandon UICollectionViewFlowLayout altogether. Self-sizing cells work fine in a composable layout.