Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. [self.collectionView performBatchUpdates:^{
  2.  
  3. // Update the datasource
  4. [self updateTasks];
  5.  
  6. // Insert the new item into the collection
  7. [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:[self.tasks indexOfObject:task] inSection:0]]];
  8.  
  9. } completion:^(BOOL finished) {
  10.  
  11. // reload data and scroll
  12. [self.collectionView reloadData];
  13. [self.collectionView scrollToItemAtIndexPath:@[[NSIndexPath indexPathForItem:[self.tasks indexOfObject:task] inSection:0] atScrollPosition:UICollectionViewScrollPositionTop animated:YES];
  14.  
  15. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement