CircleStatus 1.2.2

CircleStatus 1.2.2

测试已测试
语言语言 Obj-CObjective C
许可 Apache 2
发布上次发布2016年5月

Natalia Osiecka 维护。



  • 作者
  • natalia.osiecka

CircleStatus

这是一个简单的项目,用于显示带可配置数字和颜色范围的外环圆形图表,带有背景透明度/颜色配置。包含演示项目。在方向改变和重新绘制时表现良好。还支持图例视图。

示例

可定制的颜色,可以开启或关闭图例(要查看图例,请查看下面的截图)

CircleStatus img1

可以调整环中每种颜色的百分比。您还可以更改您想要开始绘制颜色的点

CircleStatus img2

您可以在中间附加图片或文本(或什么都不加)

CircleStatus img3

可以修改边框宽度

CircleStatus img4

背景可以是透明的或任何颜色。如果总百分比小于100%,则圆的剩余部分是透明的(如右所示)

CircleStatus img5

展望

您可以做得比这更多 ^^^

CircleStatus CircleStatus CircleStatus CircleStatus

安装

子模块

在您的项目 git 文件夹中输入

git submodule init
git submodule add --copy link to the repo--
git submodule update

从 CircleStatus/CircleStatus 文件夹中复制所有文件

只需下载和附件

这强烈不建议,因为您将无法看到代码更新。克隆或下载源代码,然后从 CircleStatus/CircleStatus 文件夹中复制所有文件。

实现

通过克隆并查看演示来了解有关实现的更多示例。您可以通过 Storyboard 或使用代码添加视图

// in your view.h download the library
#import <CircleStatus/NOCSView.h>
// then add a property
@property (nonatomic, strong) NOCSView *csView;

// alloc & init the view or setup this via storyboard
- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _csView = [[NOCSView alloc] initWithFrame:frame]; // + update the frame
        [self addSubview:_csView];
    }
    return self;
}

// in your controller you can change outlook of the control
- (void)viewDidLoad {
    [super viewDidLoad];

    // fill with data
    [_csExampleView.csView setPercentageColorArray:@[[[NOCSPercentageColor alloc] initWithColor:[UIColor greenColor] percentage:0.7f],
                                                     [[NOCSPercentageColor alloc] initWithColor:[UIColor yellowColor] percentage:0.3f]]];
    // setup middle view: either text or image or nothing
    [_csExampleView.csView.textLabel setText:@"Chart"];
//    [_csExampleView.csView.imageView setImage:[UIImage imageNamed:@"test"]];
    // setup chart view
    [_csExampleView.csView setRadius:50.f];
    [_csExampleView.csView setFillColor:[UIColor colorWithWhite:1.f alpha:0.4f]];
    [_csExampleView.csView setStartAngle:15];
    [_csExampleView.csView setLineWidth:10];
    // setup legend
    [_csExampleView.csView setShowsLegend:NO];
    [_csExampleView.csView.legendView setLegendPosition:CSLegendPositionRight];
}

变更日志

  • 1.2.0 通用代码重构。添加了前缀,使用 NOCategories。
  • 1.1.3 使 javadoc 更易读。
  • 1.1.2 修复了重绘时的错误。更新了 javadoc。
  • 1.1.1 静音 pod lint 警告。
  • 1.1 应用样式,少量代码重构。
  • 1.0 添加了基本类。添加了演示。

作者

Natalia Osiecka,[email protected]

许可

在 Apache 2.0 许可下可用。有关更多信息,请参阅 LICENSE 文件。

需求

需要Xcode 5,针对iOS 5.1.1或更高版本

Bitdeli Badge