如何将一幅图片保存为文件存储
作者: Cocoa China 【最热的Mac, iPhone专业开发论坛】【本文永久地址】
25
Mar
以下是将图片保存为PNG的代码。也可以保存为TIFF, BMP, GIF, JPEG格式。
NSBitmapImageRep *bits = …; // get a rep from your image, or grab from a view
NSData *data;
data = [bits representationUsingType: NSPNGFileType
properties: nil];
[data writeToFile: @"/path/to/wherever/test.png"
atomically: NO];
发表评论