从iphone应用程序启动照片库

irp*_*alo 3 iphone photo gallery launch

是否可以从我的应用程序启动(重定向用户)iphone的本机照片库应用程序,类似于电子邮件?现在可以在4.2 sdk中使用吗?

Chi*_*tel 6

为此,您必须创建并呈现UIImagePickerController如下:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
[self presentModalViewController:imagePicker animated:YES];
Run Code Online (Sandbox Code Playgroud)

如果您希望用户改为使用相机imagePicker.sourceType,imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;则可以更改为.

委托方法:- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info将为您提供info字典中的图像.