views:

270

answers:

1

Hi guys,

In Safari and other browsers, there is a bar that would indicate the percentage of the loading progress, and I, myself, trying to implement something similiar on iPhone, when loading some content in UIWebView, I would like the app to indicate the percentage of the page being loaded.

I tried some google search and realize we could use NSURLConnection to read only the header and get the Content-Length ( but don't know how to, I read the Apple's NSURLConnection docs but probably I missed something ... ). And the size ( kb ) which UIWebView had loaded, seem like UIWebView don't support it for the public API... I hope this would be complete in some other ways than I thought, so if you have any ideas, please throw it out, thanks for your patient reading.

P.S : I could just show an Activities Indicator for users with the long loading progress actions of the UIWebView but I just want to go further with the loading percentage bar :).

Regards.

+1  A: 

If you're using UIWebView, there's not much fine-grained information you can get from it. If you look at the UIWebViewDelegate Protocol Reference, the only real callbacks you'll get are (1) asking if it should load the page, (2) when it starts loading the page, (3) when it finishes loading the page successfully, (4) when there was an error.

In other words, there is no delegate method indicating the incremental progress of the load.

Shaggy Frog
Thanks Shaggy :)
niha7229