A general question on UIWebViews. I have a single webview in my app. There are buttons on the left which simply load up different URLs into the webview.
Are there any ill consequences to loading a new URL into the webview without [webview stopLoading] the previous request first?
For example, this flow could happen:
- User presses button1 to load urlA into the webview
- While urlA is still loading, user presses button2 to load urlB into the webview
But would this better?
- User presses button1 to load urlA into the webview
- While urlA is still loading and user presses button2 for urlB
- First call [webview stopLoading], then proceed to load urlB.
Are there any best practices for such a scenario? Does it matter either way?
Thanks!
According to the documentation,
stopLoadinghas to be called before the view is going to disappear or be destroyed. This implies that an asynchronous event would just survive, potentially causing havoc.However, no mention is made of your scenario. I would still call
stopLoadingjust do be on the safe side. If theloadingproperty of the web view isNO, this method simply does nothing.