2010-10-13 79 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