Skip to content

Instantly share code, notes, and snippets.

@NghiaTranUIT
Created January 4, 2015 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NghiaTranUIT/604c8f4ce607ade8506c to your computer and use it in GitHub Desktop.
Save NghiaTranUIT/604c8f4ce607ade8506c to your computer and use it in GitHub Desktop.
-(void) addNewItemFromArray:(NSArray *) newArrItem
{
// Add
[_arrPhotos addObjectsFromArray:newArrItem];
NSMutableArray *arrNewIndexpath = [NSMutableArray array];
for (NSInteger i = _arrPhotos.count ; i < _arrPhotos.count + newArrItem.count ; i++)
{
NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:i inSection:0];
[arrNewIndexpath addObject:newIndexPath];
}
// Add new item with animation
[_collectionView performBatchUpdates:^{
[_collectionView insertItemsAtIndexPaths:arrNewIndexpath];
} completion:^(BOOL finished) {
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment