2010-10-13 81 views
1

我想从iPhone设备获取相册的图像路径。而且我还需要用他们的名字来扩展那张图片。路径和图像的扩展

+0

[访问映像路径(http://stackoverflow.com/questions/3922241/accessing-image-path) – willcodejavaforfood 2010-10-13 10:10:55

回答

1
newFilePath = [NSHomeDirectory() 
    stringByAppendingPathComponent: textFieldNormalFile_name.text]; 
//newFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent: @"ChosenPic.jpg"]; 
imageData = UIImageJPEGRepresentation(img, 1.0); 
if (imageData != nil) { 
    NSLog(@"HERE [%@]", newFilePath); 
    [imageData writeToFile:newFilePath atomically:YES]; 
} 
image.image =[UIImage imageNamed:newFilePath]; 
NSLog(@"newFilePath:%@",newFilePath); 
path.text =[NSString stringWithFormat:newFilePath]; 
NSLog(@"path.text :%@",path.text); 
+0

它的工作的可能重复.. :) – sandy 2010-12-14 11:16:57