Advertisement
priore

Correct way for to scroll after of reloadData completion

Feb 9th, 2016
1,361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // correct way for to scroll, or execute a block of code, only after of reloadData completion
  2. [self.collectionView reloadData];
  3. [[NSOperationQueue mainQueue] addOperationWithBlock:^{
  4.     // scroll to item
  5.     NSIndexPath *indexPath = [NSIndexPath indexPathForItem:3 inSection:0];
  6.     [self.collectionView selectItemAtIndexPath:indexPath animated:YES scrollPosition:UICollectionViewScrollPositionLeft];
  7. }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement