iPhone - 将当前视图保存为图像 [英] iPhone - saving current view as image

查看:102
本文介绍了iPhone - 将当前视图保存为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将当前视图作为图像保存到我的应用程序的相机胶卷?有可能吗?

How can I save the current view as an image to Camera roll from my application? Is it possible?

谢谢。

推荐答案

找到解决方案。可能会帮助别人。要将当前视图另存为图像,请执行以下操作:

Found the solution. Might help someone. To save the current view as an image, do the following

UIGraphicsBeginImageContext(pictureView.bounds.size); 
                

[pictureView.layer renderInContext:UIGraphicsGetCurrentContext()]; 

UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); 

这篇关于iPhone - 将当前视图保存为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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