Simply add one line to your Podfile:
pod 'CCActivityIndicatorView'
Add CCActivityIndicatorView.h
and CCActivityIndicatorView.m
to your project.
#import "CCActivityIndicatorView.h" self.myactivityIndicatorView = [CCActivityIndicatorView new]; // Show with the default type [self.myactivityIndicatorView show];
Or you can specify the type to show
self.myactivityIndicatorView = [CCActivityIndicatorView new]; // CCActivityIndicatorView with type CCIndicatorTypeScalingDots [self.myactivityIndicatorView showWithType:CCIndicatorTypeScalingDots]; // CCActivityIndicatorView with type CCIndicatorTypeLeadingDots [self.myactivityIndicatorView showWithType:CCIndicatorTypeLeadingDots]; // CCActivityIndicatorView with type CCIndicatorTypeCircle [self.myactivityIndicatorView showWithType:CCIndicatorTypeCircle]; // CCActivityIndicatorView with type CCIndicatorTypeArc [self.myactivityIndicatorView showWithType:CCIndicatorTypeArc];
Then when some tasks have completed, use
[self.myactivityIndicatorView dismiss];
// Set public properties before showing it. // Set the backgrond color. The default color is black. self.myactivityIndicatorView.backColor = <#UIColor#>; // Set the background border color. The default background color is black. self.myactivityIndicatorView.borderColor = <#UIColor#>; // Set the backgrond border width. THe default value is 0. self.myactivityIndicatorView.borderWidth = <#CGFloat#>; // Set the background corner radius. The default value is 10.0; self.myactivityIndicatorView.cornerRadius = <#CGFloat#>; // Set the indicator color. The default color is white. self.myactivityIndicatorView.indicatorColor = <#UIColor#>; // Set the boolean value that indicates whether the ohter UIViews are user-interactable. The default value is YES. self.myactivityIndicatorView.isTheOnlyActiveView = <#BOOl#>; // Set the appear animation type. self.myactivityIndicatorView.appearAnimationType = <#CCIndicatorAppearAnimationType#>; // Set the disappear animation type. self.myactivityIndicatorView.disappearAnimationType = <#CCIndicatorDisappearAnimationType#>;
typedef NS_ENUM(NSInteger, CCIndicatorType) { CCIndicatorTypeScalingDots, // Default type CCIndicatorTypeLeadingDots, CCIndicatorTypeCircle, CCIndicatorTypeArc };
typedef NS_ENUM(NSInteger, CCIndicatorAppearAnimationType) { CCIndicatorAppearAnimationTypeSlideFromTop, CCIndicatorAppearAnimationTypeSlideFromBottom, CCIndicatorAppearAnimationTypeSlideFromLeft, CCIndicatorAppearAnimationTypeSlideFromRight, CCIndicatorAppearAnimationTypeFadeIn // Default type };
typedef NS_ENUM(NSInteger, CCIndicatorDisappearAnimationType) { CCIndicatorDisappearAnimationTypeSlideToTop, CCIndicatorDisappearAnimationTypeSlideToBottom, CCIndicatorDisappearAnimationTypeSlideToLeft, CCIndicatorDisappearAnimationTypeSlideToRight, CCIndicatorDisappearAnimationTypeFadeOut // Default type };
iOS 8.0 or later
Any Pull Requests are welcome.