How to get image path from photo library and how to retrieve the image from photo library in iphone?

后端 未结 2 1803
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 02:12

I\'m new to iphone. In my small application, how to get image path from photo library. I use this following code to getting images and placed in imageview.

         


        
2条回答
  •  时光取名叫无心
    2020-12-16 02:47

    UIImagePickerControllerOriginalImage returns only the image's data, with no reference to its local storage. I haven't used it myself but I guess what you are looking for is

    NSURL* localUrl = (NSURL *)[info valueForKey:UIImagePickerControllerReferenceURL];
    

    At least, it's the only way I know of to retrieve any URL.

    To retrieve the image, have a look at this question. But also keep in mind, that you already have the image retrieved with

    UIImage* image=(UIImage*)[info objectForKey:@"UIImagePickerControllerOriginalImage"];
    

    so ask yourself if you really need this.

提交回复
热议问题