ios保存图片到本地沙盒和读取

保存到沙盒只要先把沙盒路径写好,直接存入就行了


/*保存到沙盒

UIImage * imgsave =self.img.image;

NSString * path =NSHomeDirectory();

NSString * Pathimg =[path stringByAppendingString:@"/Documents/111.png"];

[UIImagePNGRepresentation(imgsave) writeToFile:Pathimg atomically:YES];

NSLog(@"%@",path);//这是沙盒路径

*/

/*

NSString * PATH =[NSString stringWithFormat:@"%@/Documents/%@.png",NSHomeDirectory(),@"text"];

image.image=[[UIImage alloc]initWithContentsOfFile:PATH];

*/

你可能感兴趣的:(ios保存图片到本地沙盒和读取)