转载

[iOS] 一个简单的 App Loading 视图

CCActivityIndicatorView

Captures

[iOS] 一个简单的 App Loading 视图 [iOS] 一个简单的 App Loading 视图 [iOS] 一个简单的 App Loading 视图 [iOS] 一个简单的 App Loading 视图

Installation

Use Cocoapods

Simply add one line to your Podfile:

pod 'CCActivityIndicatorView' 

Manually

Add CCActivityIndicatorView.h and CCActivityIndicatorView.m to your project.

Easy to use

#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];

Customisable

Public properties

// 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#>;

Animation Type

Indicator animation type

typedef NS_ENUM(NSInteger, CCIndicatorType) {     CCIndicatorTypeScalingDots, // Default type     CCIndicatorTypeLeadingDots,     CCIndicatorTypeCircle,     CCIndicatorTypeArc };

Appear animation type

typedef NS_ENUM(NSInteger, CCIndicatorAppearAnimationType) {     CCIndicatorAppearAnimationTypeSlideFromTop,     CCIndicatorAppearAnimationTypeSlideFromBottom,     CCIndicatorAppearAnimationTypeSlideFromLeft,     CCIndicatorAppearAnimationTypeSlideFromRight,     CCIndicatorAppearAnimationTypeFadeIn // Default type };

Disappear animation type

typedef NS_ENUM(NSInteger, CCIndicatorDisappearAnimationType) {     CCIndicatorDisappearAnimationTypeSlideToTop,     CCIndicatorDisappearAnimationTypeSlideToBottom,     CCIndicatorDisappearAnimationTypeSlideToLeft,     CCIndicatorDisappearAnimationTypeSlideToRight,     CCIndicatorDisappearAnimationTypeFadeOut // Default type };

Requirement

iOS 8.0 or later

TODO

  • More types of animation

Any Pull Requests are welcome.

原文  https://github.com/Cokile/CCActivityIndicatorView
正文到此结束
Loading...