如何直接进入"All Photos"相册?

How to getting into the "All Photos" Albums directly?

我的代码是这样的:

oldPicker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
   oldPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
   oldPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:oldPicker.sourceType];
}
oldPicker.delegate = self;
oldPicker.allowsEditing = NO;
[self presentViewController:oldPicker animated:YES completion:nil];

效果是当我点击按钮时,它显示了选择视图的相册,但我只想跳过选择视图的相册并直接显示 "All Photos" 个相册。

我尝试将 sourceType 设置为 UIImagePickerControllerSourceTypeSavedPhotosAlbum,但它显示 "Moments" 专辑而不是 "All Photos" 专辑

使用 UIImagePickerController 无法做到这一点。

UIImagePickerControllerSourceType 只有 3 个值可用。

enum
{
  UIImagePickerControllerSourceTypePhotoLibrary,
  UIImagePickerControllerSourceTypeCamera,
  UIImagePickerControllerSourceTypeSavedPhotosAlbum
};
typedef NSUInteger UIImagePickerControllerSourceType;

Constants

UIImagePickerControllerSourceTypePhotoLibrary

Specifies the device’s photo library as the source for the image picker controller.

UIImagePickerControllerSourceTypeCamera

Specifies the device’s built-in camera as the source for the image picker controller. Indicate the specific camera you want (front or rear, as available) by using the cameraDevice property.

UIImagePickerControllerSourceTypeSavedPhotosAlbum

Specifies the device’s Camera Roll album as the source for the image picker controller. If the device does not have a camera, specifies the Saved Photos album as the source.

因此,为了实现您提到的场景,您需要编写自己的图像选择器。有可用的自定义控件,您也可以检查 CTAssetsPickerController