Reloading a UICollectionView using reloadData method returns immediately before reloading data

前端 未结 3 1217
北海茫月
北海茫月 2020-12-07 19:34

I need to know when reloading a UICollectionView has completed in order to configure cells afterwards (because I am not the data source for the cells - other wise would have

3条回答
  •  星月不相逢
    2020-12-07 20:04

    Collection view is not supported to be reloaded animatedly with help of reloadData. All animations must be performed with methods, such as

    [collectionView deleteItemsAtIndexPaths:indexesToDelete];
    [collectionView insertSections:sectionsToInsert];
    [collectionView reloadItemsAtIndexPaths:fooPaths];
    

    inside of performBatchUpdates: block. That reloadData method can only be used for rough refresh, when all items are removed and laid out again without animation.

提交回复
热议问题