图片压缩

2017-10-19  本文已影响15人  06f43b0b52f7

(void)saveImage:(UIImage *)tempImage WithName:(NSString *)imageName

{

NSData* imageData = UIImagePNGRepresentation(tempImage);

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString* documentsDirectory = [paths objectAtIndex:0];

// Now we get the full path to the file

NSString* fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];

// and then we write it out

[imageData writeToFile:fullPathToFile atomically:NO];

}

上一篇下一篇

猜你喜欢

热点阅读