开发者

imagePickerController:didFinishPickingMediaWithInfo issue

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜