UIImagePickerController open in camera roll

2019-04-29 07:28发布

Is it possible to open camera roll directly with UIImagePickerController but still have the back button to your album list?

UIImagePickerControllerSourceTypeSavedPhotosAlbum will open only the camera roll without the option to slide back to albums.

3条回答
劫难
2楼-- · 2019-04-29 07:34

I came across the same situation.And found a solution,here's the code.Hope it helps.

pImagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
id albumCtrller = pImagePicker.topViewController;
pImagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[pImagePicker pushViewController: albumCtrller animated: NO];

Now you can open album and have a back navigatebutton.

查看更多
我只想做你的唯一
3楼-- · 2019-04-29 07:57

I would rather suggest you to use custom imagepickers like elcimagepicker. afer going through the code properly you can achieve the thing you want with the help of minor manipulations.

查看更多
Ridiculous、
4楼-- · 2019-04-29 07:59

Unfortunately, the answer is -- it's not possible. At least not through any standard interface. It might be possible to do some view hierarchy mining or method swizzling to make it happen, but then you may run afoul of the App Store submissions review.

From the Camera Programming Topics of iOS (bolded emphasis mine):

Instead of using the camera as the media source, you use the Camera Roll album or Saved Photos album, or the entire photo library.

And:

Source type To configure the picker for browsing saved media as opposed to capturing a new picture or movie, set its sourceType property to one of the saved photo sources:

Use UIImagePickerControllerSourceTypePhotoLibrary to present a browser that provides access to all the photo albums on the device, including the Camera Roll album on devices that have a camera.

Use UIImagePickerControllerSourceTypeSavedPhotosAlbum to present a browser that restricts access to the Camera Roll album on devices that have a camera, or to the Saved Photos album on devices that don’t.

查看更多
登录 后发表回答