Created
July 26, 2012 09:14
-
-
Save pratikshabhisikar/3181152 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void) reloadTableCellsAtIndexPaths:(NSArray *) indexPaths { | |
NSArray *visibleTableCells = [self.tableView indexPathsForVisibleRows]; | |
[indexPaths enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(id obj, NSUInteger idx, BOOL *stop){ | |
BOOL isVisible = [visibleTableCells containsObject:obj]; | |
if (isVisible) { | |
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:obj] withRowAnimation:UITableViewRowAnimationFade]; | |
} | |
}]; | |
} | |
#pragma mark - PBDownloadImageOperation delegates | |
-(void) imageDownloadOperation:(PBImageDownloadOperation *) imageDownloadOperation didDownloadImageData:(NSData *) imageData { | |
// Cache the image. | |
[imageCache cacheObject:imageData forKey:imageDownloadOperation.imageURL]; | |
[self performSelectorOnMainThread:@selector(reloadTableCellsAtIndexPaths:) withObject:[NSArray arrayWithObject:imageDownloadOperation.imageIndexPath] waitUntilDone:NO]; | |
} | |
-(void) imageDownloadOperation:(PBImageDownloadOperation *)imageDownloadOperation didFailWithError:(NSError *) error { | |
// Display error and/or optionally retry the image downloading... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment