如何将UIWebView的内容保存为图像(How do I save the contents of a UIWebView as an image)

编程入门 行业动态 更新时间:2024-10-22 04:57:21
如何将UIWebView的内容保存为图像(How do I save the contents of a UIWebView as an image)

我想将UIWebView的内容保存为图像。 我的代码只保存了屏幕上可见的网页内容。

- (IBAction)saveImage:(id)sender { UIGraphicsBeginImageContext(webCanvas.frame.size); [self.webCanvas.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil,nil,nil); }

我想要它所以它会将整个网页保存在UIWebView包括屏幕UIWebView不到的网站部分。 这可能吗?

I want to save the content of UIWebView as an image. The code I have only saves the content of the webpage that is visible on the screen.

- (IBAction)saveImage:(id)sender { UIGraphicsBeginImageContext(webCanvas.frame.size); [self.webCanvas.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage =UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil,nil,nil); }

I want it so it will save the whole webpage in the UIWebView including the part of the website that is not visible on screen. Is this possible?

最满意答案

你需要检查这些: - 当webview大于屏幕时,将UIWebview内容转换为UIImage 如何拍摄整个视图的iPhone屏幕截图,包括屏幕外的部分? 希望这会帮助你。

You will need to check these:- Convert UIWebview contents to a UIImage when the webview is larger than the screen How to take an iPhone screenshot of entire view including parts off screen? Hope this will help you.

更多推荐

本文发布于:2023-08-01 00:49:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1351394.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   保存为   图像   内容   UIWebView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!