Deferring viewWillAppear until webViewDidFinishLoad

后端 未结 2 1904
我在风中等你
我在风中等你 2021-02-15 10:43

I have an application that uses UIWebViews in several view controllers. The UIWebViews are used to render locally generated html, no slow network acce

2条回答
  •  春和景丽
    2021-02-15 11:20

    Lots of solutions here I think. A quick one is to load your UIWebView with it's hidden property set to YES. Then set your UIViewController as the UIWebViews delegate and implement:

    - (void)webViewDidFinishLoad:(UIWebView *)webView

    where you set the property back to NO.

    A thing to note is that webViewDidFinishLoad will fire more than once if you have framed/embedded content. So you have to keep track of this. Shouldn't really be a problem if you are loading local content.

提交回复
热议问题