Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ramakser/a0553f3f65998b061c3fd6bae08877bf to your computer and use it in GitHub Desktop.
Save ramakser/a0553f3f65998b061c3fd6bae08877bf to your computer and use it in GitHub Desktop.
resultsSize contains the size of the data source array, self.results, before new data is added from the data at newImages.
[self.collectionView performBatchUpdates:^{
int resultsSize = [self.results count];
[self.results addObjectsFromArray:newImages];
NSMutableArray *arrayWithIndexPaths = [NSMutableArray array];
for (int i = resultsSize; i < resultsSize + newImages.count; i++)
[arrayWithIndexPaths addObject:[NSIndexPath indexPathForRow:i inSection:0]];
[self.collectionView insertItemsAtIndexPaths:arrayWithIndexPaths];
} completion:nil];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment