如何从照片库中获取图像路径并从iphone中的照片库中检索图像?

时间:2011-10-18 07:28:19

标签: iphone

  

可能重复:
  How to get image path from photo library and how to retrieve the image from photo library in iphone?

我是iphone的新手。在我的小应用程序中,如何从照片库获取图像路径。我使用以下代码来获取图像并放置在imageview中。

-(IBAction) selectimage
{
    UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    //picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
    [self presentModalViewController:picker animated:YES];  
    NSLog(@"UIPicker=%@",picker);
}

- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary

{
imageView.image=info;
[UIPicker dismissModalViewControllerAnimated:YES];
NSLog(@"UImage path= %@",imageView.image);
}

它成功地置于Imageview。但是我无法将其imagepath存储到DB中。我正在使用NSLog("Image path= %@",imageview.image);它在控制台中显示"Image Path= UIImage: 0x6819790"。如何获取其路径以及如何从照片库中检索照片。

我目前的流程如下:UIImagePickerController - >用户从照片中选择图像 - > selectedImage设置为UIImageView的实例 - >现在我想拍摄这张图片并将其存储在数据库中。

如何获取存储到db的映像路径以及如何使用其imagepath从db检索映像。 任何身体帮助我。提前谢谢。

1 个答案:

答案 0 :(得分:1)

我认为this链接可以帮助您。 你也可以在那里找到代码。

相关问题