6
votes

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

Is there any way to do that?

5
have u tried setting the source type property of imagepickercontroller?SriPriya

5 Answers

2
votes

Use

imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

It will directly take you to camera roll.

0
votes

It is very simple to do that ... For an example of a button ... You click on the button and then try to use :

imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; 

By using that you will force the Controller to use the camera. .

[self presentModalViewController:imgPicker animated:YES]; 

imgPicker is here the name of my controller

0
votes

To achieve this you have only oneway..

You can create customImagePickerController and grab display all camera roll images in it.

For that you can use collectionview

or else

https://github.com/rahulmane91/CustomAlbumDemo

May this useful to you.

Thanks & Regards Nirav Zalavadia

0
votes

make use of 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 above code and put your album name whose data you want to Fetch in the place of "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 anywhere you want to display all albums images

0
votes

Tou can use this code to access directly

imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum

but you will have to have a better UI

Try this framework which gives both cam and cam roll

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