PNChart中的circleChart简单使用

要做这个这样的效果:

自己写轮子也挺烦的,正好后面还要写曲线图什么的在网上找了个三方PNChart,pod继承进来包一下头文件#import <PNChart.h>然后就可以用了,没什么好说的贴代码:

self.circleChart = [[PNCircleChart alloc] initWithFrame:CGRectMake(0, 0, 148, 148)
                                                      total:@100
                                                    current:@80
                                                  clockwise:YES shadow:YES shadowColor:[UIColor lightGrayColor]];
  
    self.circleChart.backgroundColor = [UIColor clearColor];
    self.circleChart.displayAnimated = NO;//动画效果隐藏,一刷新就转挺烦的
    [self.circleChart setStrokeColor:[UIColor lightGrayColor]];
    [self.circleChart setStrokeColorGradientStart:[UIColor colorWithRed:6/255.0 green:149/255.0 blue:157/255.0 alpha:1]];
    [self.circleChart strokeChart];
  
    self.circleChart.countingLabel.hidden = YES;//把那个百分号给去掉,我还要写别的东西呢
    [self.circleView addSubview:self.circleChart];

背景透明了自己在view上面贴lable就好了,我是用xib拖得,懒。。

posted @ 2017-11-03 15:04  7舅老爷  阅读(1040)  评论(0编辑  收藏  举报