try
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
UICollectionViewLayoutAttributes *layoutAttributes = [self.dynamicAnimator layoutAttributesForCellAtIndexPath:indexPath];
if(!layoutAttributes) {
layoutAttributes = [super layoutAttributesForItemAtIndexPath:indexPath];
}
return layoutAttributes;
}
when you execute performBatchUpdates
, [self.dynamicAnimator layoutAttributesForCellAtIndexPath:
returns nil
if cell which will be created by update is not visible.
So just returns super
(perhaps UICollectionViewFlowLayout
)'
s layoutAttributes
for now.
And when the cell about to be displayed, UIDynamicAnimator
will do the job for you.