3

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

4

1 回答 1

6

为此,您必须创建并呈现UIImagePickerController这样的:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
[self presentModalViewController:imagePicker animated:YES];

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

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

于 2010-11-25T09:31:05.640 回答