zhwl

 

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

-(IBAction) selectimage
{UIImagePickerController*picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;[self presentModalViewController:picker animated:YES];[picker release];}-(void) imagePickerController:(UIImagePickerController*)UIPicker didFinishPickingMediaWithInfo:(NSDictionary*) info
{[UIPicker dismissModalViewControllerAnimated:YES];
imageview.image=[info objectForKey:"UIImagePickerControllerOriginalImage"];NSLog("Image Path=%@",imageview.image);}

其成功放到 Imageview。但我不能得到其 imagepath。我使用的 nslog("%@",imageview.image) ;它显示"图像路径 ="在控制台中。如何获得它的路径,以及如何从照片库中检索的照片。任何机构帮助我。先谢谢了。

 

 

回答 #1

UIImagePickerControllerOriginalImage仅返回的图像数据,根本没有提到其本地存储。我自己没有用,但我猜你所寻找的

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

至少,这是我知道的检索任何 URL 的唯一方法。

若要检索图像,看一看这个问题。但也请记住,您已经使用检索的图像,

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

所以问自己,是否你真的需要这样。

分类:

技术点:

相关文章:

  • 2021-11-25
  • 2021-07-27
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2022-02-23
  • 2021-09-23
  • 2021-05-15
  • 2021-07-07
相关资源
相似解决方案