Sunday, July 8, 2012

Showing Network Activity When there Isn’t Any

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;

No comments:

Post a Comment