CCActivityIndicatorView 1.4.5

CCActivityIndicatorView 1.4.5

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2016年6月

Cokile 维护。



  • 作者:
  • Cokile

截图

安装

手动安装

将 CCActivityIndicatorView 文件夹中的 .h 和 .m 文件添加到您的项目中。

ImageIO.framework 添加到您的目标中。

易于使用

#import "CCActivityIndicatorView.h"

self.myactivityIndicatorView = [CCActivityIndicatorView new];

// Show with the default type
// The 1st capture
[self.myactivityIndicatorView 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];

或者您甚至可以使用自己的 GIF 文件

self.myactivityIndicatorView = [CCActivityIndicatorView new];

// Show with GIF
// The 5th capture
[self.myactivityIndicatorView showWithGIFName:@"test.gif"];

然后当某些任务完成时,只需简单使用

[self.myactivityIndicatorView dismiss];

或者在消失之前显示一些文本

// The 1st capture
[self.myactivityIndicatorView dismissWithText:@"This is a sample dismiss text" delay:0.5];

注意

您不应在 viewDidLoad 中显示 CCActivityIndicatorView,动画将不会工作!

相反,应在 viewWillAppearviewDidAppear 中显示。

可定制

公共属性

// 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 或更高版本

鸣谢

uiimage-from-animated-gif : 一个加载动画 GIF 的 UIImage 分类。

待办事项

  • 更多类型的动画

欢迎任何拉取请求。