开发者

How to convert contents of a hidden webview to uiimage?

开发者 https://www.devze.com 2023-03-06 17:41 出处:网络
In my application, I converted the contents loaded in a UIWebView to a UIImage and had shown it in an UIImageView.

In my application, I converted the contents loaded in a UIWebView to a UIImage and had shown it in an UIImageView.

Now what I want to do is have a hidden webview load contents from an URL, and then convert its contents into a UIImage.

Can any body pl开发者_StackOverflowease suggest a method?


#import <QuartzCore/QuartzCore.h>
UIGraphicsBeginImageContext(yourWebView.bounds.size);
[yourWebView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
0

精彩评论

暂无评论...
验证码 换一张
取 消