MonoTouch code snippet - Network Activity Indicator

Written on

The network activity indicator is in the status bar at the very top of the screen on an iPhone. You can see it just to the left of the time in this screenshot:

Network Activity Indicator in an iPhone app

In Objective-C, you can control when this is shown or not by this code:

// Show
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

// Hide
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

With MonoTouch and C# the code is almost identical:

// Show
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

// Hide
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;