操纵手势后从UIImageView保存图像 [英] Saving Image from UIImageView after manipulating Gestures

查看:77
本文介绍了操纵手势后从UIImageView保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过移动,捏合和旋转手势来保存图像.

I'm trying to save the image after manipulating it with move, pinch and rotate gestoures.

无论尝试什么,我得到的都是真实的图像,

All I get is the real image no matter what I tried,

我尝试在UIView容器和UIIMageView上使用UIGraphicsBeginImageContextWithOptions,但没有成功.

I tried with UIGraphicsBeginImageContextWithOptions on the UIView container and on the UIIMageView without success.

希望有人可以对此提供帮助.

Hope someone can help on this one.

谢谢

留住

推荐答案

您可以尝试以下操作:

UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0);

CGContextConcatCTM(UIGraphicsGetCurrentContext(), imageView.transform);
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

这是假设您的imageView通过对其应用的CGAffineTransform进行了转换.

This is assuming your imageView is transformed by means of a CGAffineTransform applied to it.

这篇关于操纵手势后从UIImageView保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆