Search code examples
iphoneiosuitableviewalassetslibraryaqgridview

Loading camera roll images in iOS GridView very slow


I am showing all the images from the camera roll in my iPhone app. I build an array of ALAsset * that contains the list of all images in the camera roll when the app starts. I form cells by loading these images in a image view:

// Get the full resolution image for asset
ALAssetRepresentation *assetRep = [asset defaultRepresentation]; 
UIImage *image = [UIImage imageWithCGImage:[assetRep fullResolutionImage]];
[cell.imageCropper setImage:image];

I do this when a new cell is requested in

- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index

The problem is that it lags when there are many images and the user scrolls quickly through the images. What is the correct way of handling this?


Solution

  • Consider loading the images in the background using GCD. Maybe this helps: loading images from a background thread using blocks