AFNetworkActivityIndicatorManager Class Reference
Inherits from | NSObject |
Declared in | AFNetworkActivityIndicatorManager.h |
Overview
AFNetworkActivityIndicatorManager
manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero.
You should enable the shared instance of AFNetworkActivityIndicatorManager
when your application finishes launching. In AppDelegate application:didFinishLaunchingWithOptions:
you can do so with the following code:
[[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES];
By setting isNetworkActivityIndicatorVisible
to YES
for sharedManager
, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call incrementActivityCount
or decrementActivityCount
yourself.
See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44
Tasks
-
enabled
A Boolean value indicating whether the manager is enabled.
property -
isNetworkActivityIndicatorVisible
A Boolean value indicating whether the network activity indicator is currently displayed in the status bar.
property -
+ sharedManager
Returns the shared network activity indicator manager object for the system.
-
– incrementActivityCount
Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
-
– decrementActivityCount
Decrements the number of active network requests. If this number becomes zero before decrementing, this will stop animating the status bar network activity indicator.
Properties
enabled
A Boolean value indicating whether the manager is enabled.
@property (nonatomic, assign, getter=isEnabled) BOOL enabled
Discussion
A Boolean value indicating whether the manager is enabled.
@discussion If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO.
Declared In
AFNetworkActivityIndicatorManager.h
isNetworkActivityIndicatorVisible
A Boolean value indicating whether the network activity indicator is currently displayed in the status bar.
@property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible
Discussion
A Boolean value indicating whether the network activity indicator is currently displayed in the status bar.
Declared In
AFNetworkActivityIndicatorManager.h
Class Methods
sharedManager
Returns the shared network activity indicator manager object for the system.
+ (instancetype)sharedManager
Return Value
The systemwide network activity indicator manager.
Discussion
Returns the shared network activity indicator manager object for the system.
Declared In
AFNetworkActivityIndicatorManager.h
Instance Methods
decrementActivityCount
Decrements the number of active network requests. If this number becomes zero before decrementing, this will stop animating the status bar network activity indicator.
- (void)decrementActivityCount
Discussion
Decrements the number of active network requests. If this number becomes zero before decrementing, this will stop animating the status bar network activity indicator.
Declared In
AFNetworkActivityIndicatorManager.h
incrementActivityCount
Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
- (void)incrementActivityCount
Discussion
Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator.
Declared In
AFNetworkActivityIndicatorManager.h