【发布时间】:2010-11-25 00:36:17
【问题描述】:
我正在尝试以编程方式将当前视图的图像保存到 UIImage。 当前视图包含一个背景,以及许多对图层应用了 3d 转换的 UIImageView,例如
CATransform3D t = CATransform3DIdentity;
t = CATransform3DRotate(t, rotationX, 1.0, 0, 0);
t = CATransform3DRotate(t, rotationY, 0, 1.0, 0);
object.layer.transform = t;
我目前正在使用以下代码抓取当前视图的屏幕截图:
UIGraphicsBeginImageContext(background.bounds.size);
[background.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
但是,对象上的 3d 变换会丢失,例如对象出现在保存的图像中,就好像没有应用 3d 变换一样。有没有办法以编程方式抓取包含 3d 转换的屏幕截图?
UIGetScreenImage() 不是一个选项,因为它是一个私有 API,并且此应用将进入应用商店。
【问题讨论】:
-
找到答案?
-
@Andy j 你找到解决方案了吗?
标签: iphone rotation screenshot transform layer