测试已测试 | ✓ |
语言语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2014 年 12 月 |
由 Christian Di Lorenzo 维护。
一个扁平或渐变进度视图,具有简单的颜色设置器和可自定义选项,纯 Core Graphics 实现。
showBackgroundInnerShadow
属性showBackground
progressInset
outerStrokeWidth
showStroke
borderRadius
LDProgressStripes
和 LDProgressGradient
下载项目的 zip 文件,并将类 LDProgressView
和 UIColor+RGBValues
放入您的项目中。然后在您想要使用它的文件中简单导入 "LDProgressView.h"。
以下是一些示例,如上截图所示
// default color, animated
LDProgressView *progressView = [[LDProgressView alloc] initWithFrame:CGRectMake(20, 130, self.view.frame.size.width-40, 22)];
progressView.progress = 0.40;
[self.progressViews addObject:progressView];
[self.view addSubview:progressView];
// flat, green, animated
progressView = [[LDProgressView alloc] initWithFrame:CGRectMake(20, 160, self.view.frame.size.width-40, 22)];
progressView.color = [UIColor colorWithRed:0.00f green:0.64f blue:0.00f alpha:1.00f];
progressView.flat = @YES;
progressView.progress = 0.40;
progressView.animate = @YES;
[self.progressViews addObject:progressView];
[self.view addSubview:progressView];
// progress gradient, red, animated
progressView = [[LDProgressView alloc] initWithFrame:CGRectMake(20, 190, self.view.frame.size.width-40, 22)];
progressView.color = [UIColor colorWithRed:0.73f green:0.10f blue:0.00f alpha:1.00f];
progressView.progress = 0.40;
progressView.animate = @YES;
progressView.type = LDProgressGradient;
progressView.background = [progressView.color colorWithAlphaComponent:0.8];
[self.progressViews addObject:progressView];
[self.view addSubview:progressView];
// solid style, default color, not animated, no text, less border radius
progressView = [[LDProgressView alloc] initWithFrame:CGRectMake(20, 220, self.view.frame.size.width-40, 22)];
progressView.showText = @NO;
progressView.progress = 0.40;
progressView.borderRadius = @5;
progressView.type = LDProgressSolid;
[self.progressViews addObject:progressView];
[self.view addSubview:progressView];
// stripe style, no border radius, default color, not animated
progressView = [[LDProgressView alloc] initWithFrame:CGRectMake(20, 250, self.view.frame.size.width-40, 22)];
progressView.progress = 0.40;
progressView.borderRadius = @0;
progressView.type = LDProgressStripes;
progressView.color = [UIColor orangeColor];
[self.progressViews addObject:progressView];
[self.view addSubview:progressView];
您也可以通过 UIAppearance 协议配置每个 LDProgressView,这可以在您的应用程序代理中完成。以下是一个此类配置的示例
[[LDProgressView appearance] setColor:[UIColor purpleColor]];
[[LDProgressView appearance] setBackground:[UIColor redColor]];
[[LDProgressView appearance] setFlat:@YES];
[[LDProgressView appearance] setAnimate:@YES];
[[LDProgressView appearance] setShowStroke:@YES];
[[LDProgressView appearance] setBorderRadius:@5];
[[LDProgressView appearance] setOuterStrokeWidth:@3];
[[LDProgressView appearance] setShowBackground:@NO];
[[LDProgressView appearance] setProgressInset:@5];
版权 (C) 2013 Light Design [email protected]
本协议准许任何人,无需支付任何费用,以获取本软件及其相关文档副本(以下简称“软件”),不受限制地使用、复制、修改、合并、发布、分发、颁布许可证以及/或出售软件副本,并允许提供软件的个人进行上述行为,但以下条件适用:
上述版权声明和本许可声明必须包含在软件的所有副本或实质部分的副本中。
软件按“现状”提供,不提供任何形式的明示或暗示担保,包括但不限于对适销性、针对特定目的的适用性和非侵权的担保。在任何情况下,作者或版权所有者不应对任何索赔、损害或其它责任承担任何形式的责任,无论该责任是基于合同、侵权或其它原因,源于、因之或与软件及其使用或其它方式相关。