6

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?

Amin Negm-Awad
  • 16,582
  • 3
  • 35
  • 50
Zhen
  • 12,361
  • 38
  • 122
  • 199

5 Answers5

2

Use

imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

It will directly take you to camera roll.

Pang
  • 9,564
  • 146
  • 81
  • 122
Shan
  • 131
  • 7
0

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

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

iOS Geek
  • 4,825
  • 1
  • 9
  • 30
0

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

Albi
  • 1,705
  • 1
  • 17
  • 28
0

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

keithxm23
  • 1,280
  • 1
  • 21
  • 41
MoKeS
  • 39
  • 1
  • 6