How do I save the contents of a UIWebView as an image

与世无争的帅哥 提交于 2019-12-04 06:25:56

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20793522/how-do-i-save-the-contents-of-a-uiwebview-as-an-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!