hello all
i have to make an app in my app i want select multiple image from photo library many person tell me i can’t using UIImagePickerController
please how can i do that and fix it anyone can explain it to me
thank advance
hello all
i have to make an app in my app i want select multiple image from photo library many person tell me i can’t using UIImagePickerController
please how can i do that and fix it anyone can explain it to me
thank advance
Here it is in ObjC but you can work out the “translation”
`@property (strong, nonatomic) PHFetchResult *allPhotos;
PHFetchOptions *allPhotosOptions = [[PHFetchOptions alloc] init];
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:NO]];
_allPhotos = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:allPhotosOptions];
3. Now display the images in your UICollectionView like so:
PHAsset *asset = self.allPhotos[indexPath.item];
cell.selectedTick.hidden = YES;
cell.isSelected = NO;
[self.imageManager requestImageForAsset:asset
targetSize:CGSizeMake(100, 100)
contentMode:PHImageContentModeAspectFill
options:nil
resultHandler:^(UIImage *result, NSDictionary *info) {
cell.photo.image = result;
}];
return cell;
`
4. Finally in your didSelectItemAtIndexPath method add each array item to some dictionary you want to hold them or array and process the array.
Apple has an example of using the PHPhotoLibrary here:
https://developer.apple.com/library/ios/documentation/Photos/Reference/Photos_Framework/index.html#//apple_ref/doc/uid/TP40014408
Thank you very much
have you any way for translate this code to swift or any website translate this code to swift ?
thank you advance