在i ios应用程序中保存图像 [英] Save images in a n ios app
本文介绍了在i ios应用程序中保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个贺卡应用程序。我有一些现有的模板,我也可以通过添加剪贴画,文本样式等创建新的贺卡。我已将图像保存为uiimage对象。我陷入困境,以保存这些图片供将来使用。请帮助。
I am creating a greeting card app.I have some existing templates and i also can create new greeting cards by adding cliparts ,textstyles etc.I have saved the image as a uiimage object.I am stuck at the point to save these images for future use.Please help.
推荐答案
要将UIImage保存到文件,请执行以下操作
To save a UIImage to file do the following
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/img.jpg"];
//Save
NSData* imageData = UIImageJPEGRepresentation(img, 1.0);
[imageData writeToFile:path atomically:YES];
//Load
NSData* imageData = [NSData dataWithContentsOfFile:path];
UIImage *image = [UIImage imageWithData:imageData];
这篇关于在i ios应用程序中保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文