0

UIImagePickerController 组件有问题。目前在我的应用程序中,用户可以使用选择器从保存的照片库中选择图像,没有问题。

但是,如果我在选择图像之前在 Photos.app 中UIImagePickerControllerOriginalImage裁剪并保存照片,UIImagePickerController 会在字典键中为我提供原始未裁剪的版本。

我知道UIImagePickerControllerEditedImage在选择器内完成裁剪时有效,但是在照片应用程序中完成时,此键返回 nil。

所以我的问题是,如何访问正确版本的图像(无需使用 ALAssetLibrary 滚动我自己的选择器)?

4

2 回答 2

1

解决方案很简单;我正在使用UIImagePickerControllerSourceTypeSavedPhotosAlbum而不是UIImagePickerControllerSourceTypePhotoLibrary.

于 2013-01-17T12:58:25.533 回答
0

What is your

-(void)imagePickerController:(UIImagePickerController *)pickr didFinishPickingMediaWithInfo;

method like?

Have you tried to do something like

-(void)imagePickerController:(UIImagePickerController *)pickr didFinishPickingMediaWithInfo:(NSDictionary *)info{
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
    [myImageView setImage:image];
    [pickr dismissModalViewControllerAnimated:YES];
}

(in the example it's UIImagePickerControllerEditedImage, don't know if you set YES to your picker allowEditing)

于 2013-01-17T12:29:12.487 回答