UICollection view reloadData cause recreate visible cell

abagmut picture abagmut · May 17, 2014 · Viewed 17k times · Source

When I call reloadData method of UICollectionView it cause all visible cell to blink. I found that reason of this is recreation of all visible cells, while UITableView return visible cell in – tableView:cellForRowAtIndexPath: method after reload data.

So, how can I avoid recreation of visible cells in UICollectionView.

Answer

Adam W. Dennis picture Adam W. Dennis · May 13, 2016

You need to reload the visible cells, which will not cause the flash seen during reloadData:

[myCollectionView reloadItemsAtIndexPaths:[myCollectionView indexPathsForVisibleItems]];