iOS 畫環形圖


由於新項目的的需求,需要畫環形圖,由於以前都沒接觸過這一類(我是菜鳥),去cocochina山找到了一個案例,個人覺得還可以,分享一下

github 地址https://github.com/zhouxing5311/ZZCircleProgress

 

 

這個使用起來非常的簡單

作者開放了很多接口,可以根據自己的需求進行更改

一般就是聲明一個累類就Ok了

具體實現的代碼如下

 

可能我的代碼有點不一樣,我自己加入了一些元素進去

 //無小圓點、同動畫時間
    self.zzCircleProgress = [[ZZCircleProgress alloc] initWithFrame:CGRectMake((JdryScreeWidth*0.75)+9, 16, 50, 50) pathBackColor:BACK_COLOR pathFillColor:BLUE_COLOR startAngle:270 strokeWidth:4];
    self.zzCircleProgress.showPoint = NO;
    self.zzCircleProgress.notAnimated = YES;
    self.zzCircleProgress.progress = 0.9;
    self.zzCircleProgress.fontSize = 16.0;
//    self.zzCircleProgress.animationModel = CircleIncreaseByProgress;
    self.zzCircleProgress.textColor = BLUE_COLOR;
    self.zzCircleProgress.labelStr = [NSString stringWithFormat:@"%d%%", (int)(self.zzCircleProgress.progress *100)];
    [self addSubview:self.zzCircleProgress];

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM