我有这个代码用于检索图像并将其添加到数组中:
//Set the size of the video to 1280x720
CGSize targetSize = CGSizeMake(1280, 720);
PHImageRequestOptions *options = [[PHImageRequestOptions alloc]init];
options.synchronous = YES;
PHImageManager *manager = [[PHImageManager alloc]init];
for (PHAsset *asset in self.assetsToVideofy){
[manager requestImageForAsset:asset
targetSize:targetSize
contentMode:PHImageContentModeAspectFit
options:options
resultHandler:^(UIImage *result, NSDictionary *info) {
if (result) {
[self.photosToVideofy addObject:result];
}
}];
问题是图像只会以缩略图的形式添加。如何确保将图像加载到targetSize然后添加到数组?
由于
答案 0 :(得分:1)
尝试更改为:
if (result) {
if (info[PHImageResultIsDegradedKey].boolValue == NO) {
[self.photosToVideofy addObject:result];
}
}