TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2016 |
Maintained by Cokile.
Add the .h, .m files in the CCActivityIndicatorView folder to your project.
Add ImageIO.framework
to your target.
#import "CCActivityIndicatorView.h"
self.myactivityIndicatorView = [CCActivityIndicatorView new];
// Show with the default type
// The 1st capture
[self.myactivityIndicatorView show];
Or you can specify the type to show
self.myactivityIndicatorView = [CCActivityIndicatorView new];
// CCActivityIndicatorView with type CCIndicatorTypeScalingDots
// The 1st capture
[self.myactivityIndicatorView showWithType:CCIndicatorTypeScalingDots];
// CCActivityIndicatorView with type CCIndicatorTypeLeadingDots
// The 2nd capture
[self.myactivityIndicatorView showWithType:CCIndicatorTypeLeadingDots];
// CCActivityIndicatorView with type CCIndicatorTypeCircle
// The 3rd capture
[self.myactivityIndicatorView showWithType:CCIndicatorTypeCircle];
// CCActivityIndicatorView with type CCIndicatorTypeArc
// The 4th capture
[self.myactivityIndicatorView showWithType:CCIndicatorTypeArc];
Or you can even use your own GIF file
self.myactivityIndicatorView = [CCActivityIndicatorView new];
// Show with GIF
// The 5th capture
[self.myactivityIndicatorView showWithGIFName:@"test.gif"];
Then when some tasks have completed, simply use
[self.myactivityIndicatorView dismiss];
Or you can display some text before dismiss
// The 1st capture
[self.myactivityIndicatorView dismissWithText:@"This is a sample dismiss text" delay:0.5];
Note:
You should not show CCActivityIndicatorView
within viewDidLoad
, The Animation will not work!
Instead, show it within viewWillAppear
or viewDidAppear
.
// 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#>;
// Set the background view type
self.myactivityIndicatorView.backgroundViewType = <#CCIndicatorBackgroundViewType#>;
typedef NS_ENUM(NSInteger, CCIndicatorType) {
CCIndicatorTypeScalingDots, // Default type
CCIndicatorTypeLeadingDots,
CCIndicatorTypeCircle,
CCIndicatorTypeArc
};
typedef NS_ENUM(NSInteger, CCIndicatorAppearAnimationType) {
CCIndicatorAppearAnimationTypeSlideFromTop,
CCIndicatorAppearAnimationTypeSlideFromBottom,
CCIndicatorAppearAnimationTypeSlideFromLeft,
CCIndicatorAppearAnimationTypeSlideFromRight,
CCIndicatorAppearAnimationTypeZoomIn,
CCIndicatorAppearAnimationTypeFadeIn // Default type
};
typedef NS_ENUM(NSInteger, CCIndicatorDisappearAnimationType) {
CCIndicatorDisappearAnimationTypeSlideToTop,
CCIndicatorDisappearAnimationTypeSlideToBottom,
CCIndicatorDisappearAnimationTypeSlideToLeft,
CCIndicatorDisappearAnimationTypeSlideToRight,
CCIndicatorDisappearAnimationTypeZoomOut,
CCIndicatorDisappearAnimationTypeFadeOut // Default type
};
typedef NS_ENUM(NSInteger, CCIndicatorBackgroundViewType) {
CCIndicatorBackgroundViewTypeNone, // Default type
CCIndicatorBackgroundViewTypeBlur,
CCIndicatorBackgroundViewTypeTransparent,
CCIndicatorBackgroundViewTypeShadow
};
iOS 8.0 or later
uiimage-from-animated-gif : A UIImage category that loads animated GIFs.
Any Pull Requests are welcome.