Hi,
I'm using objective-c & the iphone 3.0 sdk
I want to retrieve the contents of a URL (web page or pdf) and display it within a UIWebView
it seems that the thing to do is something like this:
NSURLRequest *requestObject = [NSURLRequest requestWithURL:myURL];
[myUIWebView loadRequest:requestObject];
this works quite well, except for 1 thing.
there are cases when the request takes a while (let's say 5-10 seconds). I have a UIActivityIndicatorView that I'd like to "start" and "stop" at the beginning and end of the load request.
HOWEVER, if I do this
[busySignal startAnimating];
NSURLRequest *requestObject = [NSURLRequest requestWithURL:myURL];
[myUIWebView loadRequest:requestObject];
[busySignal stopAnimating];
it doesn't work because the loadRequest call is done asynchronously and so my UIActivityIndicatorView stops almost immediately
Is there a way to start/stop my "busySignal" at the beginning and end of a URL request?
As an alternative, I think this can be done via NSURLConnection which gives me the callback function "connectionDidFinishLoading:"
but I can't seem to figure out how to go from NSURLConnection to displaying the web-page.
So, I guess that's 2 questions.
1. Can you start/stop a UIActivityIndicatorView at the beginning/end of a call to loadRequest: ? 2. How do you use NSURLConnection to retrieve the contents of a URL and display the information on a UIWebView?
Thanks!