2
카메라 롤, 저장된 사진에서 10-20 전체 화면 이미지를 빠르게로드하는 방법은 무엇입니까?ALAssetsLibrary가 너무 느림 - Objective-C
이 코드를 사용하고 있지만 10 장의 사진을로드하려면 약 5-10 초 정도 기다려야합니다. iPhone 4S를 사용하고 있습니다.
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
if(_savedPhotos.count>=11) *stop = YES;
[group enumerateAssetsWithOptions:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *needToStop) {
NSLog(@"%d",index);
if(_savedPhotos.count<11)
{
UIImage *image = [UIImage imageWithCGImage:result.defaultRepresentation.fullScreenImage];
[_savedPhotos addObject:image];
}
else
{
*needToStop = YES;
}
}];
} failureBlock:^(NSError *error) {
NSLog(@"%@",error.description);
}];
코드를 구현하고 전체 화면 이미지를 축소판으로 변경하고 ALAsset * 결과를 NSMutableArray에 저장하고 필요할 때 액세스 할 수 있습니다. 그것은 훨씬 빠르고 메모리가 적습니다. –
당신은 ALAssetsLibrary 직접이 –
예, 내가 뭘 미리보기를 제공합니다 .. 수동으로 썸네일 이미지를 변환하고 싶지 않아 ]; if (iref) { importMediaSaveImage.image = [UIImage imageWithCGImage : iref]; –