开发者

how to use imagePickerController:didFinishPickingMediaWithInfo:(NSDictionary *)info

开发者 https://www.devze.com 2023-01-04 22:44 出处:网络
I have to use imagePickerController:didFinishPickingMediaWithInfo:(NSDictionary *)info method beca开发者_运维问答use didFinishPickingImage is deprecated in 3.0.

I have to use imagePickerController:didFinishPickingMediaWithInfo:(NSDictionary *)info method beca开发者_运维问答use didFinishPickingImage is deprecated in 3.0.

Now my problem is that I am not getting how to retrieve the image out of it.I have to select only one image and use that image in my application.

Can someone please give me a quick demo of how things work in this method?


The implementation will be similar to what you did previously. The difference is that the UIImage is the value for one of the keys of the info dictionary. The keys are defined in the the documentation.

The image that you want will depend on whether your imagePickerController instance allows editing of the images. Assuming that you don't, you can obtain the image with the following

UIImage *pickedImage = [[info objectForKey:UIImagePickerControllerOriginalImage] retain];

// do something with pickedImage

[pickedImage release];


I know this is many months later, but I struggled with the same problem and found that though it was asked here many times, it was never answered. Well, I'm happy to say that I figured it out and so am posting it on a few of the nearly-identical questions that come up first on a search.

I posted the full answer here:
didFinishPickingMediaWithInfo return nil photo

0

精彩评论

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