保存图片信息通过NSData保存到本地文件中
//第一步:保存头像信息到NSData中
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); self.documentsPath = [paths objectAtIndex:0];
NSString *imagePath = [NSString stringWithFormat:@"%@/%@.jpg", self.documentsPath, contacts.Photo];
UIImage *tempImage = [UIImage imageWithContentsOfFile:imagePath];
headOldImageData = [NSData dataWithData:UIImageJPEGRepresentation(tempImage, 1.0)];
[headOldImageData retain];
//第二步:修改后用writeToFile归档