How do I tell when a UIWebView is done rendering (not loading)?

后端 未结 6 1980
失恋的感觉
失恋的感觉 2020-12-13 18:07

I know when its done loading... (webViewDidFinishLoad), but I want to use

[webView.layer renderInContext:UIGraphicsGetCurrentContext()];

to

6条回答
  •  囚心锁ツ
    2020-12-13 18:59

    This may depend upon the kind of graphics context you need the view rendered into, but you can call

    - (void)drawRect:(CGRect)area forViewPrintFormatter:(UIViewPrintFormatter *)formatter
    

    which apparently tricks the UIWebView into thinking that it's being printed. This may help if your ultimate goal is to capture the complete page. We've had the problem recently in which even if the page was fully loaded, calling plain old -drawRect: didn't render the entire page if some of it was offscreen.

提交回复
热议问题