简体   繁体   English

iPhone - 将当前视图保存为图像

[英]iPhone - saving current view as image

How can I save the current view as an image to Camera roll from my application? 如何将当前视图作为图像保存到我的应用程序的相机胶卷? Is it possible? 可能吗?

Thanks. 谢谢。

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); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM