2

Possible Duplicate:
How to use UIProgressView while loading of a UIWebView?

In my app i have a UIViewController with a UIWebView and a toolbar as a subviews. The toolbar has a UITextField for the address. When loading a page the address field should indicate the loading progress of the webpage something like Safari's address bar or Facebook app for iOS when loading an external link.

The problem that i face is that i can't find a way to show the progress of the page when loading, making the address field(UIText field) fill with a color.

Is there any way to do that or a component already made for this?

Community
  • 1
  • 1
Sorin Antohi
  • 6,145
  • 9
  • 45
  • 71

1 Answers1

5

To my knowledge there is no way that you could read the progress of a HTML page being loaded into an UIWebView. However I have an idea what you could do. It is a bit "around the corner" but if displaying a progress bar while loading a HTML page into a UIWebView is REALLY important to you, here is what you could do:

  1. Do not load the HTML directly into the UIWebView. Load it into memory first (you can use the ASIHTTPRequest library to do that really easily).
  2. ASIHTTPRequest offers a delegate method that allows you to access the progress of the request. Use that to display the progress.
  3. Once the HTML finished loading, render it into the UIWebView using [UIWebView loadHTMLString:]

As I mentioned before this is really unconventional, but if you really need the progress to be displayed it is the only way I can think of.

joern
  • 27,354
  • 7
  • 90
  • 105