How to display "Camera Roll" directly using ImagePickerController

I want to directly open the “Camera Roll” album using ImagePickerController instead of showing all 3 albums (camera roll, photo library, last import).

Is there any way to do this?

+6
source share
5 answers

Using

imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; 

He will directly take you into the camera frame.

+2
source

It is very simple to do ... An example of a button ... You click on a button and then try to use:

 imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; 

Using this, you force the controller to use the camera. .

 [self presentModalViewController:imgPicker animated:YES]; 

imgPicker is the name of my controller

0
source

For this, you have only once.

You can create a customImagePickerController and capture the display of all camera clip images in it.

For this you can use collectionview

or more

https://github.com/rahulmane91/CustomAlbumDemo

This is good for you.

Thanks and Regards Nirav Zalvadia

0
source

use Photos Framework

 @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]; 

Use the code above and put your album name, the data of which you want to receive in the place "Custom photo 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]); 

and use the array wherever you want to display all the album images

0
source

You can use this code for direct access.

 imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum 

but you should have a better user interface

Try this structure, which gives both cam and cam

https://github.com/hyperoslo/ImagePicker https://github.com/hyperoslo/Gallery

0
source

Source: https://habr.com/ru/post/899776/


All Articles