UICollectionView with self-sizing cells resizes cells during insert/remove animation

Number:rdar://23728611 Date Originated:02-Dec-2015 02:49 PM
Status:Open Resolved:
Product:iOS Product Version:9.1
Classification:Bug Reproducible:Always
A UICollectionView with a UICollectionViewFlowLayout should allow autolayout to allow for self-sizing cells. This works for static layouts, but when items are inserted or removed the cells resize to the estimated size before expanding again.

Steps to Reproduce:
See sample project attached.

Create a UICollectionView whose cells use autolayout to describe their size. Enable self-sizing cells by setting an estimatedItemSize on the UICollectionViewFlowLayout, e.g. layout.estimatedItemSize = CGSizeMake(10.0, 10.0);

Insert items into the UICollectionView, e.g.

[self.collectionView performBatchUpdates:^{
    [self.collectionView insertItemsAtIndexPaths:@[indexPath]];
} completion:nil];

Expected Results:
When inserting/removing items, the cells maintain their size.

Actual Results:
Cells reset to their estimated size before expanding to their actual size.

Note: if the estimatedItemSize is larger than the actual size, the app will crash. That's for another radar.

iOS 9.1

Broken since iOS 8.0


Another dupe at rdar://35717256

By Roland.Leth at Nov. 28, 2017, 7:59 a.m. (reply...)

Created a duplicate at rdar://35038472

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!