【问题标题】:PHImageManager returns thumbnails instead of requested sizePHImageManager 返回缩略图而不是请求的大小
【发布时间】:2014-10-13 10:03:24
【问题描述】:

我有这段代码用于检索图像并将其添加到数组中:

//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 加载然后添加到数组中?

谢谢

【问题讨论】:

  • 缩略图的大小是多少?

标签: ios photokit


【解决方案1】:

尝试更改为:

if (result) {
    if (info[PHImageResultIsDegradedKey].boolValue == NO) {
        [self.photosToVideofy addObject:result];
    }
}

【讨论】:

    猜你喜欢
    • 2013-03-02
    • 2012-11-19
    • 2021-08-10
    • 1970-01-01
    • 2020-11-12
    • 2020-07-30
    • 2014-11-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多