简体   繁体   English

如何从UIWebView创建UIImage

[英]How to create UIImage from UIWebView

In the ipad app im planning to do, it will be all about loading web pages in UIWebView. 在计划要执行的ipad应用程序中,将只涉及在UIWebView中加载网页。 I have a feature wherein I will display previews of the UIWebViews, more like thumbnails of these web pages. 我有一个功能,其中将显示UIWebView的预览,更像是这些网页的缩略图。 How do I do this? 我该怎么做呢? generating UIImage from these web pages would be cool... Hope someone can help me achieve this. 从这些网页生成UIImage很酷...希望有人可以帮助我实现这一目标。

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

this resultImageView will be your answer... 这个resultImageView将是你的答案...

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

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