开发者

imagePickerController:didFinishPickingMediaWithInfo issue

开发者 https://www.devze.com 2023-02-14 21:12 出处:网络
What is the result if I didn\'t edit the picture? (image = nil ? or image = OriginalImage) picker.allowsImageEditing = YES;

What is the result if I didn't edit the picture?

(image = nil ? or image = OriginalImage) 

picker.allowsImageEditing = YES;

- (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWith开发者_运维百科Info:(NSDictionary *)info
{
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
}


Either the key would not exist in the dictionary or it would be the same as the original image. The easiest thing to do is just to code defensively:

UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
if (!image) image = [info objectForKey:UIImagePickerControllerOriginalImage];

That way you'll still get sane results even if the behavior is different on different versions of iOS.

0

精彩评论

暂无评论...
验证码 换一张
取 消