SLCPolygonView 0.1.2

SLCPolygonView 0.1.2

Maintained by yang666.



  • By
  • WeiKunChao

SLCPolygonView

Carthage compatible CocoaPods compatible License: MIT

多边形功能视图,用于显示进度百分比!

pod 'SLCPolygonView'

初始化

SLCPolygonView * polygonView = [[SLCPolygonView alloc] initWithPercentageValues:@[@(80),@(60),@(90),@(80)]
sideLength:100];
polygonView.frame = CGRectMake(50, 50, polygonView.itemSize.width, polygonView.itemSize.height);
[self.view addSubview:polygonView];

代理

1.1 自定义扩散线.

- (CAShapeLayer *)polygonView:(SLCPolygonView *)polygon diffusionLineAtIndex:(NSInteger)index
{
CAShapeLayer * shape = CAShapeLayer.layer;
shape.strokeColor = UIColor.whiteColor.CGColor;
shape.lineWidth = 1;
return shape;
}

1.2 自定义关键点.

- (CGSize)polygonView:(SLCPolygonView *)polygon pointItemSizeAtIndex:(NSInteger)index
{
return CGSizeMake(6, 6);
}

- (CAGradientLayer *)polygonView:(SLCPolygonView *)polygon pointAtIndex:(NSInteger)index
{
CAGradientLayer * layer = CAGradientLayer.layer;
layer.backgroundColor = UIColor.whiteColor.CGColor;
layer.cornerRadius = 3;
layer.masksToBounds = YES;
return layer;
}

1.3 自定义内部功能图.

- (CAShapeLayer *)progressFunctionViewForPolygonView:(SLCPolygonView *)polygon
{
CAShapeLayer * layer = CAShapeLayer.layer;
layer.fillColor = UIColor.redColor.CGColor;
return layer;
}

1.4 自定义外边框.

- (CAShapeLayer *)custormPolygonForPolygonView:(SLCPolygonView *)polygon

Alt text.