Correct way for to scroll after of reloadData completion

Feb 9th, 2016
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. }];
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.