将整个UIWebView内容保存到相机胶卷iOS

时间:2013-11-25 12:55:11

标签: uiwebview

到目前为止,我可以从Web视图中保存图像(768,3000);到我的相机胶卷,但它切断了屏幕上当前没有显示的任何网页视图的内容?

-(IBAction)capturaScreenButton:(id)sender
{
    UIAlertView *alert;

     CGSize sixzevid=CGSizeMake(768,3000);

    CGSize size = [webView sizeThatFits:CGSizeZero];
    UIGraphicsBeginImageContextWithOptions( size, YES, 0.0);

    UIGraphicsBeginImageContext(sixzevid);
    //UIGraphicsBeginImageContextWithOptions(self.webView.bounds.size, self.webView.opaque, 0.0);
    [self.webView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);

    alert = [[UIAlertView alloc] initWithTitle:@"Image captured by Me"
                                       message:@"The image is in your Photo Album..."
                                      delegate:self cancelButtonTitle:@"Ok"
                             otherButtonTitles:nil];
    [alert show];
    [alert release];
    UIGraphicsEndImageContext();

}

0 个答案:

没有答案