iPhone Developer Tips Stats: Past 30 days - Pageviews: 88,766 Visitors: 61,679 Thank you everyone! Let's shoot for 100,000 by May. Pass it on...
|
I found that sometimes you may be doing something in your iPhone application that requires the user to wait while it completes. Often this is a network related activity, but in other cases it may not be. In my case I was parsing the response from a network connection and wanted the network activity indicator to keep spinning even though it had already downloaded the content.
Here is a quick tip on how to trigger the display of the network activity indicator (spinning icon at the top left of the screen) on an iPhone from within your application:
1
2
3
4
5
6
7
| // start the indicator ...
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
// Do something that may take some time to complete ...
// stop the indicator ...
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; |
Comments
2 Responses to “Showing Network Activity When there Isn’t Any”
Leave Comment
FYI, I have confirmed that this doesn’t show up in the Simulator (2.2.1), but DOES work on the device.
I heard that it does work on the simulator but only if you are connected to the net via ethernet. Weird!
Editor’s Note: This is in reference to the SDK 3.x., where the spinner now works in the simulator