iphone - UIWebView loading and general performance -


i using uiwebview display textual content in app (i store content in local html files pack app). together, have 3 web views content change dynamically based on user feedback.

although might argue not accepted way, find uiwebview convenient display formatted text, , modify text using html if necessary. while works 99% of time, on occasion, experience problems fall 1 of these categories:

  1. sometimes, web view content loads slow , late second or so.
  2. the content loads not showing. however, long as, touch view (try scroll or something) content pops in.
  3. a few times received memory warnings (usually not long after app's initial loading) in no way affected performance of app. logged memory warning app worked nothing happened.

this method use load content web views:

- (void)loadsimpledocument:(nsstring*)documentname inview:(uiwebview*)webview { nsstring *path = [[nsbundle mainbundle] pathforresource:documentname oftype:@"html"]; nsurl *url = [nsurl fileurlwithpath:path]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; [webview loadrequest:request]; } 

aside this, shouldstartloadwithrequest delegate method implemented, returning yes.

my question is: there way improve reliability/performance of web views (in particular loading)? there have overlooked, did wrong, or not know about?

some additional info: on ios6 sdk, use arc, , programmatically (do not use ib or storyboard).

you have 2 options check what's going on:

  • implement webviewdidstartload & webviewdidfinishload delegate methods check why content isn't showing (may content isn't loaded yet).

  • read html content nsstring use loadhtmlstring:baseurl instead of using loadrequest , check if loads faster.

hope help.


Comments