UIWebView loadHTMLString shows blank screen

前端 未结 3 863
一向
一向 2021-02-07 04:52

I have a strange problem with UIWebView\'s loadHTMLString, where it would only display a blank view when I called loadHTMLString with my content HTML string. It does not matter

3条回答
  •  感情败类
    2021-02-07 05:04

    After a bit of detective work, I found out that returning NO in the delegate function

    - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    

    will reject loadHTMLString requests. Returning YES solved my problem.

提交回复
热议问题