iOS->将2个UIImageView保存到cameraRoll
我有两层 UIImageView,上面一层是部分透明的,第二层是“背景”。我想将它们保存起来,就像用户从前面看到它们一样,放入相机卷中以供用户使用。问题是这样写:
if(gridUpperLayer == transparent) {drawGridLowerLayer}
else {drawGridUpperLayer}
会非常慢(而且我不知道如何实现它)。有人知道如何以更快的方式做到这一点吗?最好是有例子,但我将不胜感激^^ 干杯并提前感谢您!
i have two layers of UIImageView, upper one is partly transparent, second in is 'background'. I want to save them both like user see them from front into cameraRoll for user's use. The problem is writing it in way:
if(gridUpperLayer == transparent) {drawGridLowerLayer}
else {drawGridUpperLayer}
will be very slow (and i dont know how to implement it). Anybody has idea how to do it in faster way..? Best would be with example but i would be grateful for anything ^^
Cheers and thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过将 CALayer 渲染为包含这两个图像的 UIView 的图像来实现此目的。以下代码如下所示:
//将图像保存到磁盘
You can do this by rendering the CALayer into an image for the UIView that contains both of the images. The following code would look like:
//save anImage to disk