问题
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