嗨如何從iPhone中的指定圖像路徑檢索圖像。在我的代碼是如何從iPhone中的指定圖像路徑檢索圖像
- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary
{
imageView.image=info;
[UIPicker dismissModalViewControllerAnimated:YES];
NSLog(@"UImage path= %@",imageView.image);
NSData* imageData = UIImagePNGRepresentation(imageView.image);
NSString* imageName = @"MyImage.png";
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* documentsDirectory = [paths objectAtIndex:0];
NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
[imageData writeToFile:fullPathToFile atomically:NO];
NSLog(@"Image path = %@",fullPathToFile);
}
當我選擇圖像,圖像應放置,它將成功放置到圖像視圖。我得到了圖像路徑。
當我執行控制檯應用程序這表明
Image path=document = /Users/rr-mac/Library/Application Support/iPhone Simulator/4.3/Applications/46C716D0-13E9-4DF2-BC46-F1071DFCE14C/Documents/MyImage.png
我的圖像存儲在這個指定的路徑。在這裏,我如何檢索這個圖像並將其放置到imageview。任何人都可以幫我提供代碼。
在此先感謝。
感謝它工作正常。 – akk