vishalv2050
vishalv2050

Reputation: 883

reloadData in performBatchUpdates:completion: does not call cellForItemAtIndexPath:

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.

Upvotes: 3

Views: 2259

Answers (1)

Lawrence Kesteloot
Lawrence Kesteloot

Reputation: 4368

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.

Upvotes: 2

Related Questions