[ios]简单的饼图代码推荐
在iphone上画报表,有收费的方案,一般开源的推荐就是:
不过,如果你只是想画饼图,同时也不想给自己找太多麻烦,或是项目时间太紧,可以试试以下这个简单的方案。
代码来自 cocoachina.com
使用这段代码有常见的两个问题的解决方案
1:阴影
如果你不想要原来代码中的阴影,搜”CGFloat CGGradientCreateWithColorComponents“,把第二个参数改成nil。
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorspace, nil, nil, 2);
2.缺角
当你做了第一步之后,会发现饼缺一个角,这应该是一个Bug.
搜”只有弧度《 3.14 的才会画前面的厚度”把else中的break改成continue.
相关文章:
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.






Comments
No comments yet.
Leave a comment