Deferring viewWillAppear until webViewDidFinishLoad

后端 未结 2 1895
我在风中等你
我在风中等你 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:17

    I like monowerker's solution best, but another solution would be to hold onto the already-rendered UIWebView all the time (in some more permanent object than the view controller). I'd only do that if the look of monowerker's solution is too disruptive.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题