美文网首页
多边形功能图SLCPolygonView

多边形功能图SLCPolygonView

作者: 师傅我坚持不住了 | 来源:发表于2018-11-15 11:32 被阅读14次

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

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
多功能图.jpg

如有bug或问题,请私信.github地址.

相关文章

网友评论

      本文标题:多边形功能图SLCPolygonView

      本文链接:https://www.haomeiwen.com/subject/sqzefqtx.html