Tag Archives: indicator

Better way of handling network activity indicator

Since iOS 2.0 application could control network activity indicator in the status bar. Responsible application should show it when network access is in progress and hide when all network activities are done.
Network Activity Indicator
This could be achieved by using networkActivityIndicatorVisible property of UIApplication.

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
// do some network stuff
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

This approach works great if you have only one place where network access is possible. And there is only one thread.

But we’re living in a very complex world and, usually, we could have several threads accessing networks. So we can’t just show and hide indicator. We have to show it when first thread starts network activities and hide when last thread stops activities.
Continue reading