làm sử dụng các hình ảnh Khung
@property(nonatomic , strong) PHFetchResult *assetsFetchResults;
NSMutableArray *array;
PHFetchOptions *fetchOptions = [[PHFetchOptions alloc] init];
fetchOptions.predicate = [NSPredicate predicateWithFormat:@"title = %@", @"Custom Photo Album"];
collection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum
subtype:PHAssetCollectionSubtypeAny
options:fetchOptions].firstObject;
_assetsFetchResults = [PHAsset fetchAssetsInAssetCollection:collection options:nil];
Sử dụng đoạn mã trên và đặt tên album của bạn có dữ liệu bạn muốn Fetch ở nơi "Custom Ảnh Album"
PHFetchResult *collectionResult = [PHAsset fetchAssetsInAssetCollection:collection options:nil];
for (int h=0; h<[collectionResult count]; h++) {
PHAsset *asset1 = collectionResult[h];
[_imageManager requestImageForAsset:asset1 targetSize:frame.size contentMode:PHImageContentModeAspectFill options:nil resultHandler:^(UIImage *result, NSDictionary *info)
{
[array2 addObject:result];
}];
}
NSLog(@"array count%lu",(unsigned long)[array2 count]);
và sử dụng mảng ở bất kỳ nơi nào bạn muốn hiển thị tất cả hình ảnh album
Nguồn
2017-06-17 04:04:11
bạn đã thử đặt thuộc tính loại nguồn của imagepickercontroller chưa? – SriPriya