UICollectionView with self sizing cells uses estim

2019-04-05 18:12发布

问题:

I'm using UICollectionView with self sizing cells and have set the estimatedItemSize property for this to work.

When performing a delete animation however, the cells animate to their position if they were sized with the estimatedItemSize property, rather than their auto layout (actual) size.

What's worse is that our cells are variable sizes and there doesn't seem to be a method like UITableView where we can pass an estimated size per index path.

I attempted to subclass the collection view flow layout and override the initialLayoutAttributesForAppearingItemAtIndexPath(_:) and finalLayoutAttributesForDisappearingItemAtIndexPath(_:), but on inspection the superclass's return values for these methods are correct.

Does anyone know of a solution to this seemingly basic bug?