ALAssetRepresentation *representation = [asset defaultRepresentation];
image=[UIImage imageWithCGImage:[representation fullResolutionImage]];
[selectedAllImages addObject:image];
url = [representation url];
Why do you getting fullResolutionImage in cellForRowAtIndexPath method? And putting into selectedAllImages array.. it seems like selectedAllImages array fills by fullresolutionimages infinity (during scrolling).
assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:imageURL
resultBlock:resultblock
failureBlock:nil];
Why you create assetslibrary and request for same asset (which have same url)?
I think you should simplify your 'cellForRowAtIndexPath' method, to be more lightweight during scrolling. Something like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
ALAsset *asset = [self.images objectAtIndex:indexPath.row];
ALAssetRepresentation *representation = [asset defaultRepresentation];
cell.cellLabel.text = [representation filename];
cell.cellImageView.image = [UIImage imageWithCGImage:[asset thumbnail]];
return cell;
}