[英]How to get image Type In PHAsset(PNG or JPG)?
In iOS8 and later, i get images at this code: 在iOS8及更高版本中,我通过以下代码获取图像:
PHFetchOptions *option = [[PHFetchOptions alloc] init];
option.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
PHFetchResult *result = [PHAsset fetchAssetsInAssetCollection:_collection options:option];
[result enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (((PHAsset *)obj).mediaType == PHAssetMediaTypeImage) {
PHCachingImageManager *imageManager = [[PHCachingImageManager alloc] init];
PHAsset *asset = obj;
PHImageRequestOptions * options = [[PHImageRequestOptions alloc] init];
options.networkAccessAllowed = YES;
options.synchronous = YES;
[imageManager requestImageDataForAsset:asset options:options resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
/*******/
/* Now I get image type in here with imageDate*/
/* I just want JPG type Image*/
}];
}
}];
But in this code, I need a lot of time, So how can I get Image Type with PHAsset and don't use requestImageData 但是在这段代码中,我需要很多时间,所以如何使用PHAsset获取图像类型并且不使用requestImageData
据我所知,您无法通过PHAsset获取图像类型,但是可以通过CIImage的属性properties(properties是属性的名称)来获取
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.