简体   繁体   English

如何直接进入“所有照片”相册?

[英]How to getting into the “All Photos” Albums directly?

My code is like this: 我的代码是这样的:

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

The effects is when I click the button,it shows me the albums choosing view,but I just want to skipping the albums choosing view and directly show the "All Photos" albums. 效果是,当我单击按钮时,它向我显示选择视图的相册,但我只想跳过选择视图的相册并直接显示“所有照片”相册。

I have tried to setting the sourceType to UIImagePickerControllerSourceTypeSavedPhotosAlbum , but it shows me the "Moments" albums but not the "All Photos" albums 我尝试将sourceType设置为UIImagePickerControllerSourceTypeSavedPhotosAlbum ,但是它显示的是“ Moments”相册,而不是“ All Photos”相册

There is no way to do that using UIImagePickerController . 无法使用UIImagePickerController做到这一点。

There are only 3 values available for UIImagePickerControllerSourceType . 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. 通过使用cameraDevice属性指示所需的特定摄像头(前部或后部,如果可用)。

 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. 如果设备没有相机,则将“已保存的照片”相册指定为来源。

So for achieving the scenario you mentioned you need to write your own image picker. 因此,为了实现您提到的方案,您需要编写自己的图像选择器。 There is a custom control available, you can check that also CTAssetsPickerController 有一个自定义控件,您可以检查CTAssetsPickerController

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM