要作这个这样的效果:动画
本身写轮子也挺烦的,正好后面还要写曲线图什么的在网上找了个三方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