图片的读取
// 图片路径
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *imagePath = [path stringByAppendingPathComponent:@"iconImage.png"];
/*读取入图片*/
//因为拿到的是个路径,所以把它加载成一个data对象
NSData *data = [NSData dataWithContentsOfFile:imagePath];
UIImage *image = [UIImage imageWithData:data];
// 图片路径
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) lastObject];
NSString *imagePath=[path stringByAppendingPathComponent:@"iconImage.png"];
// 将图片写到Documents文件中
[UIImagePNGRepresentation(image) writeToFile:imagePath atomically:YES];
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) lastObject];
NSString *imagePath=[path stringByAppendingPathComponent:@"iconImage.png"];
// 将图片写到Documents文件中
[UIImagePNGRepresentation(image) writeToFile:imagePath atomically:YES];