Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [self.collectionView performBatchUpdates:^{
- // Update the datasource
- [self updateTasks];
- // Insert the new item into the collection
- [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:[self.tasks indexOfObject:task] inSection:0]]];
- } completion:^(BOOL finished) {
- // reload data and scroll
- [self.collectionView reloadData];
- [self.collectionView scrollToItemAtIndexPath:@[[NSIndexPath indexPathForItem:[self.tasks indexOfObject:task] inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement