You can save Images in NSCache
. so that it won't refresh your Cell
each time while you scroll and it can increase your scroll speed rate. Using NSCache
you can check for the image if it is available or not. if no you can download and save in NSCache
.
declare NSCahe *imageCache;
Then in cellForItemAtIndexPath
try the below Code Snippet :
if (cell.cellimageview.image == nil) {
dispatch_queue_t downloadQueue = dispatch_queue_create("image downloader", NULL);
dispatch_async(downloadQueue, ^{
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString: [setFacebookimage objectAtIndex:indexPath.row]]];
UIImage *image = [UIImage imageWithData:data];
[imageCache setObject:image forKey:[setFacebookimage objectAtIndex:indexPath.row]];
dispatch_async(dispatch_get_main_queue(), ^{
cell.cellimageview.image = image;
});
});
}