Skip to content

appcorn/ACActivityIndicatorQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ACActivityIndicatorQueue

This simple class provieds a convinient way of queueing the visibility state of the Network Activity Indicator on the iPhone.

Usage

To queue activity just use the two static methods from any part/thread of your application:

- (void)makeRESTCall {
	// First request
	[ACActivityIndicatorQueue startActivity];
	[NSURLConnection connectionWithRequest:request1 delegate:self];
	
	// Seccond request
	[ACActivityIndicatorQueue startActivity];
	[NSURLConnection connectionWithRequest:request2 delegate:self];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
	[ACActivityIndicatorQueue endActivity];
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
	[ACActivityIndicatorQueue endActivity];
}

- (void)cancelAllRequestsButtonPressed:(id)sender {
	[ACActivityIndicatorQueue resetAndStopActivity];
}

Your Network Activity Indicator will correctly reflect the status of network activity, even if you atempt to show and hide the indicator from different parts of the code asynchronous.

The resetAndStopActivity method will reset the queue, forcing the indicator to be hidden immediately. (Thanks Jens! http://github.com/jk/ACActivityIndicatorQueue/commit/ec7b411cda39acc04969c03b25fabcc41d962bfc )

License

ACActivityIndicatorQueue is released under the MIT-license (see the LICENSE file)

About

Very simple class to add queue functionality to the iPhone Network Activity Indicator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published