在使用移动、捏合和旋转手势操作图像后,我正在尝试保存图像。
不管我怎么努力,我得到的都是真实的图像,
我尝试在 UIView 容器和 UIIMageView 上使用 UIGraphicsBeginImageContextWithOptions 但没有成功。
希望有人能在这方面提供帮助。
谢谢,
义泰
最佳答案
你可以试试这个:
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0);
CGContextConcatCTM(UIGraphicsGetCurrentContext(), imageView.transform);
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
这是假设您的 imageView
是通过应用于它的 CGAffineTransform
进行转换的。
关于iphone - 操作手势后从 UIImageView 保存图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14758060/