PNChart中的circleChart簡單使用

要作這個這樣的效果:動畫

本身寫輪子也挺煩的,正好後面還要寫曲線圖什麼的在網上找了個三方PNChart,pod繼承進來包一下頭文件#import <PNChart.h>而後就能夠用了,沒什麼好說的貼代碼:spa

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拖得,懶。。code

相關文章
相關標籤/搜索