【问题标题】:Capture UIWebview as UIImage in the background在后台将 UIWebview 捕获为 UIImage
【发布时间】:2011-08-03 10:03:55
【问题描述】:

我想知道是否有任何技巧可以在后台对 UIWebView 进行“屏幕捕获”?为了澄清更多,我可以使用以下方法捕获 UIWebView:

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

但我确实必须将屏幕上显示的 UIWebView 才能捕获它,我只是想知道我是否可以在后台执行此操作?

谢谢, 劳伦斯

【问题讨论】:

    标签: iphone uiwebview uiimage screen capture


    【解决方案1】:

    是的,您可以捕获 webview。但它只会捕获屏幕的可见部分。

    例如,如果您的网页浏览高度将超过 480 (iphone),那么您无法捕获 480+ 的部分。

    【讨论】:

      【解决方案2】:

      SwViewCapture 可以将 UIWebView 的所有内容转换为 UIImage。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-07
        • 2010-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-10
        • 1970-01-01
        相关资源
        最近更新 更多