|
[Objective-C] fix for crash when called the reloadData of a UITableView |
|
 |
// workaround for crash when called the reloadData method during scrolling of a UITableView
[yourTableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
// workaround for crash when called the reloadData method during scrolling of a UICollectionView
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[yourCollectionView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
}];
// NOTE: remember that you should always cancel the request in dealloc!!
- (void)dealloc
{
[NSObject cancelPreviousPerformRequestsWithTarget:yourTableView];
[NSObject cancelPreviousPerformRequestsWithTarget:yourCollectionView];
[super dealloc];
}
|
|
|
|
|
|
|
|
Copyright © 1996-2021 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581. |
|
|
|