图像的路径和扩展

时间:2010-10-13 10:01:41

标签: objective-c

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

1 个答案:

答案 0 :(得分: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);