iPhone
※画像をDocument下に保存しよう!
NSString* docDir = [NSHomeDirectory() stringByAppendingPathComponent:”Documents”];
NSString* photoFilePath = [NSString stringWithFormat:”%@/画像名.png”, docDir];
[UIImagePNGRepresentation(【UIImage名】) writeToFile:photoFilePath atomically:YES];
※保存したら存在するか確認してみよう!
NSFileManager* manager = [NSFileManager defaultManager];
NSString* docDir = [NSString stringWithFormat:”Document/%.png”,myCollectionSpot_.imageTitle];
NSString* paths = [NSHomeDirectory() stringByAppendingPathComponent:docDir];
if([manager fileExistsAtPath: paths]){
ある!
}else{
ない!
}
※確認ができたら、次は表示させてみてください!
NSString* paths = [NSHomeDirectory() stringByAppendingPathComponent: “Documents/画像名.png”];
NSData* imageData =[NSData dataWithContentsOfFile:paths];
UIImage* docImage =[UIImage imageWithData:imageData];
testimage.image = docImage;
参考URL:
http://libro.tuyano.com/index3?id=561007&page=2
http://i.studio23c.com/?cat=20