Is possible PrintScreen or save in an image some part of the screen?

落花浮王杯 提交于 2019-12-07 22:26:13

问题


Is it possible? I need save the sreen and send from iPad to a WebService... Concretly the problem is that i want simulate a sign in the screen and later save this sign in a NSData and send by email.

Some idea?

thanks for all!

Best regards!


回答1:


UIView *view = ...; // Get root view of current view controller

UIGraphicsBeginImageContext(view.bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

NSData *imageData = UIImagePNGRepresentation(viewImage);


来源:https://stackoverflow.com/questions/8927227/is-possible-printscreen-or-save-in-an-image-some-part-of-the-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!