reloadData in performBatchUpdates:completion: does not call cellForItemAtIndexPath:

試著忘記壹切 提交于 2021-02-07 20:07:19

问题


So I was playing around my UITableView when I noticed that this code:

[self performBatchUpdates:^{
    [self reloadData];
} completion:^(BOOL finished) {}];

does not lead to cellForItemAtIndexPath: being called, only sizeForItemAtIndexPath of UICollectionViewFlowLayout is called.

Does anybody have any idea why this is happening?

I know exactly what happens in reloadData but this is different from that.


回答1:


From the docs of reloadData: "It should not be called in the methods that insert or delete rows, especially within an animation block implemented with calls to beginUpdates and endUpdates." Perhaps this also applies to performBatchUpdates.



来源:https://stackoverflow.com/questions/25134727/reloaddata-in-performbatchupdatescompletion-does-not-call-cellforitematindexpa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!