Note that there are some explanatory texts on larger screens.

plurals
  1. POUIActivityIndicatorView start/stop before & after web-page request
    primarykey
    data
    text
    <p>I'm using objective-c &amp; the iphone 3.0 sdk</p> <p>I want to retrieve the contents of a URL (web page or pdf) and display it within a <code>UIWebView</code></p> <p>it seems that the thing to do is something like this:</p> <pre><code>NSURLRequest *requestObject = [NSURLRequest requestWithURL:myURL]; [myUIWebView loadRequest:requestObject]; </code></pre> <p>this works quite well, except for 1 thing.</p> <p>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.</p> <p>HOWEVER, if I do this</p> <pre><code>[busySignal startAnimating]; NSURLRequest *requestObject = [NSURLRequest requestWithURL:myURL]; [myUIWebView loadRequest:requestObject]; [busySignal stopAnimating]; </code></pre> <p>it doesn't work because the loadRequest call is done <em>asynchronously</em> and so my UIActivityIndicatorView stops almost immediately</p> <p>Is there a way to start/stop my "busySignal" at the beginning and end of a URL request?</p> <p>As an alternative, I <strong>think</strong> this can be done via NSURLConnection which gives me the callback function "connectionDidFinishLoading:"</p> <p>but I can't seem to figure out how to go from NSURLConnection to displaying the web-page.</p> <p>So, I guess that's 2 questions.</p> <p><strong>1.</strong> Can you start/stop a UIActivityIndicatorView at the beginning/end of a call to loadRequest: ? <strong>2.</strong> How do you use NSURLConnection to retrieve the contents of a URL and display the information on a UIWebView?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload