【发布时间】:2010-09-03 02:28:41
【问题描述】:
我目前正在使用以下代码将 CGContext 写入磁盘上的 PNG:
CGImageRef image = CGBitmapContextCreateImage(context);
UIImage *myImage = [UIImage imageWithCGImage:image];
NSData *data = UIImagePNGRepresentation(myImage);
[data writeToFile:path atomically:YES];
我发现生成的文件的方向与它在屏幕上的显示方式(在 iPhone 上)相反。保存时翻转此图像的最佳方法是什么,以便稍后加载图像时它会正确显示?
【问题讨论】:
标签: iphone cocoa-touch uikit core-graphics