views:

1071

answers:

2

I am loading a webpage from an external server using UIWebView. The page loads very slowly. Using Edge, it takes ~30 seconds. Using WiFi, it takes ~5-6 seconds. The same page is much faster when loading directly through Safari.

In the simulator, the UIWebView is very responsive.

Has anyone had any experience in increase the performance of the UIWebView? One thought I had was using static HTML pages and images, and loading/populating units of data with JSON.

A: 

That is because the Simulator is using your broadband connection.

Geoff
Simulator was running on my laptop which was using the same WiFi connection as my phone.
your simulator also has a much faster CPU and gobs of RAM
Ben Gottlieb
+1  A: 

UIWebView is simply slow to load up compared to anything else, even when using simple static HTML. A UILabel is always far faster.

I think this is because some aspects of the HTML engine you may not need (like the Javascript interpreter) take some time to load. But even if you keep an already created instance of a UIWebView around, it's still noticeably slow to load new content.

One possibility would be to keep a UIWebView in the background, and grab an image from it to display - then you'd avoid a display lag. That would break cut & paste though, and possibly not work depending on how a UIWebView not in the display felt like rendering.

The static HTML with JSON loads is probably about as fast as you are going to get. On a 3Gs it might not even much much of a noticeable delay.

Kendall Helmstetter Gelner