项目
在 GitHub 查看
mownier/MONActivityIndicatorView
关于
MONActivityIndicatorView is an awesome custom activity indicator view for iOS.
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文MONActivityIndicatorView
MONActivityIndicatorView is an awesome custom activity indicator view for iOS.
![MONActivityIndicatorView] (https://raw.github.com/mownier/MONActivityIndicatorView/master/MONActivityIndicatorView-Screenshot.gif)
Installation
Manual Install
- Copy and add the files
MONActivityIndicatorView.handMONActivityIndicatorView.mto your project. - Add the QuartzCore framework to your project.
- Then do,
import MONActivityIndicatorView.h
From CocoaPods
- Add
pod 'MONActivityIndicatorView'to your Podfile. - Then
pod installin the terminal.
Usage
Initialization
- (void)viewDidLoad {
[super viewDidLoad];
MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
[self.view addSubview:indicatorView];
}
Toggling Indicator
[indicatorView startAnimating];
[indicatorView stopAnimating];
Customization
Default Property Values
- Animation delay :
delay = 0.2 - Animation duration :
duration = 0.8 - Number of circles :
numberOfCircles = 5 - Circle's radius :
radius = 10 - Circle's internal spacing :
internalSpacing = 5 - Circle's background Color :
defaultColor = [UIColor lightGrayColor]
Custom Property Values
- (void)viewDidLoad {
[super viewDidLoad];
MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
indicatorView.numberOfCircles = 3;
indicatorView.radius = 20;
indicatorView.internalSpacing = 3;
indicatorView.duration = 0.5;
indicatorView.delay = 0.5
indicatorView.center = self.view.center;
[self.view addSubview:indicatorView];
[indicatorView startAnimating];
}
Custom Circle's Background Color
First, assign the MONActivityIndicatorViewDelegate protocol to a view controller. Then, implement the method activityIndicatorView:circleBackgroundColorAtIndex:
@interface ViewController : UIViewController <MONActivityIndicatorViewDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
MONActivityIndicatorView *indicatorView = [[MONActivityIndicatorView alloc] init];
indicatorView.delegate = self;
indicatorView.numberOfCircles = 3;
indicatorView.radius = 20;
indicatorView.internalSpacing = 3;
indicatorView.duration = 0.5;
indicatorView.delay = 0.5
indicatorView.center = self.view.center;
[self.view addSubview:indicatorView];
[indicatorView startAnimating];
}
- (UIColor *)activityIndicatorView:(MONActivityIndicatorView *)activityIndicatorView
circleBackgroundColorAtIndex:(NSUInteger)index {
// For a random background color for a particular circle
CGFloat red = (arc4random() % 256)/255.0;
CGFloat green = (arc4random() % 256)/255.0;
CGFloat blue = (arc4random() % 256)/255.0;
CGFloat alpha = 1.0f;
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
@end
探索相关项目
加载中…