简体   繁体   English

在后台将UIWebview捕获为UIImage

[英]Capture UIWebview as UIImage in the background

I wonder whether there is any tricks to do a "screen capture" a UIWebView in the background? 我想知道是否有任何技巧可以在后台“截屏” UIWebView? To clarify more, I am able to capture the UIWebView using: 为了澄清更多,我能够使用以下方法捕获UIWebView:

UIGraphicsBeginImageContext(webView.frame.size);
[webView.layer renderInContext: UIGraphicsGetCurrentContext()];
viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
theImageView.image = viewImage;

but I really have to the UIWebView displayed on the screen in order to capture it, I just wonder whether I can do this in the background? 但是我真的必须要在屏幕上显示UIWebView才能捕获它,我只是想知道是否可以在后台执行此操作?

Thanks, Lawrence 谢谢劳伦斯

SwViewCapture could convert all content of UIWebView to UIImage. SwViewCapture可以将UIWebView的所有内容转换为UIImage。

img

Yes you can capture webview. 是的,您可以捕获Webview。 But it will capture only the visible portion of the screen. 但是它将仅捕获屏幕的可见部分。

For example if your web views height will be more then 480 (iphone) then you can not capture the portion that is 480+. 例如,如果您的网络视图高度将超过480(iphone),则您将无法捕获到480+的部分。

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

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