项目介绍:
项目简介
YLProgressBar是一个UIProgressView的替代品,在核心图表算法中包含一个高度的全面的自定义动画进度条。
它已经可以用核心图表框架来实现,不需要任何图片,所以它可以自由的自定义,并且独立于平台。
使用方法
下面是一些例子,YLProgressBar是如何配置的:
//蓝色扁平化进度条,没有条纹
_progressBar.type = YLProgressBarTypeFlat;
_progressBar.progressTintColor = [UIColor blueColor];
_progressBar.hideStripes = YES;
// 绿色圆形/光泽进度条,带有左方向垂直动画条纹
_progressBar.type = YLProgressBarTypeRounded;
_progressBar.progressTintColor = [UIColor greenColor];
_progressBar.stripesOrientation = YLProgressBarStripesOrientationVertical;
_progressBar.stripesDirection = YLProgressBarStripesDirectionLeft;
// 彩虹扁平化进度条,在进度条上显示文本
NSArray *rainbowColors = @[[UIColor colorWithRed:33/255.0f green:180/255.0f blue:162/255.0f alpha:1.0f],
[UIColor colorWithRed:3/255.0f green:137/255.0f blue:166/255.0f alpha:1.0f],
[UIColor colorWithRed:91/255.0f green:63/255.0f blue:150/255.0f alpha:1.0f],
[UIColor colorWithRed:87/255.0f green:26/255.0f blue:70/255.0f alpha:1.0f],
[UIColor colorWithRed:126/255.0f green:26/255.0f blue:36/255.0f alpha:1.0f],
[UIColor colorWithRed:149/255.0f green:37/255.0f blue:36/255.0f alpha:1.0f],
[UIColor colorWithRed:228/255.0f green:69/255.0f blue:39/255.0f alpha:1.0f],
[UIColor colorWithRed:245/255.0f green:166/255.0f blue:35/255.0f alpha:1.0f],
[UIColor colorWithRed:165/255.0f green:202/255.0f blue:60/255.0f alpha:1.0f],
[UIColor colorWithRed:202/255.0f green:217/255.0f blue:54/255.0f alpha:1.0f],
[UIColor colorWithRed:111/255.0f green:188/255.0f blue:84/255.0f alpha:1.0f]];
_progressBar.type = YLProgressBarTypeFlat;
_progressBar.hideStripes = YES;
_progressBar.indicatorTextDisplayMode = YLProgressBarIndicatorTextDisplayModeProgress;
_progressBar.progressTintColors = rainbowColors;
// 允许渐变色以适应进度宽度
_progressBar.progressStretch = YES;
你也可以使用UIAppearence协议立即配置所有的进度条:
[[YLProgressBar appearance] setType:YLProgressBarTypeFlat];
[[YLProgressBar appearance] setProgressTintColor:[UIColor blueColor]];
github地址:https://github.com/yannickl/YLProgressBar