我有一个 ALAssetRepresentation 问题。有一个表格以高分辨率显示画廊图像。fullScreenImage 方法耗时太长,表格运行缓慢。如何实现更快的加载?例如,画廊图像加载立即发生在https://itunes.apple.com/us/app/print-studio-print-photos/id601882801?mt=8,他们怎么能做到这一点?
ALAsset *result = photos[_index];
UIImageView *photoView = (UIImageView*)[contentView viewWithTag:PHOTO_VIEW];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
ALAssetRepresentation *represintation = [result defaultRepresentation];
NSURL* aURL = represintation.url;
[library assetForURL:aURL resultBlock:^(ALAsset *asset){
UIImage *copyOfOriginalImage = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullScreenImage] scale:0.3 orientation:UIImageOrientationUp];
copyOfOriginalImage = [copyOfOriginalImage imageByScalingAndCroppingForSize:CGSizeMake(600, 600)];
dispatch_async(dispatch_get_main_queue(), ^{
[photoView setImage:newImg];
[photoView setNeedsDisplay];
});
}
failureBlock:nil];
});