priore

fix for crash when called the reloadData of a UITableView

Apr 29th, 2014
850
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // workaround for crash when called the reloadData method during scrolling of a UITableView
  2. [yourTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  3.  
  4. // workaround for crash when called the reloadData method during scrolling of a UICollectionView
  5. [[NSOperationQueue mainQueue] addOperationWithBlock:^{
  6.     [yourCollectionView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  7. }];
  8.  
  9. // NOTE: remember that you should always cancel the request in dealloc!!
  10. - (void)dealloc
  11. {
  12.     [NSObject cancelPreviousPerformRequestsWithTarget:yourTableView];
  13.     [NSObject cancelPreviousPerformRequestsWithTarget:yourCollectionView];
  14.     [super dealloc];
  15. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

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

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

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

×