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

2020-05-04 08:47发布

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?

登录 后发表回答