有效地拍摄大型UIWebView的快照?

时间:2015-09-25 21:01:36

标签: ios uiwebview snapshot

我已经尝试了以下代码来获取UIWebView的屏幕截图,其界限大于屏幕的界限(例如,大约1200pts),但屏幕截图始终显示为Web视图的顶部,拉伸垂直向下以覆盖它应该绘制的整个矩形。有任何想法吗?我可以使用-renderInContext:来做,但这是一个较慢且过时的方法。这是我目前的代码:

UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, scale);
    [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;

0 个答案:

没有答案
相关问题