ios 用程序绘制饼图的demo(3)
来源:未知 责任编辑:责任编辑 发表时间:2015-03-01 01:33 点击:次
CGPathMoveToPoint(path, nil, starx, stary);
CGPathAddArc(path, nil, 160, 230, 150, startAngle, endAngle, 0);
CGPathAddLineToPoint(path, nil, endx, endy1);
CGPathAddArc(path, nil, 160, 230 + spaceHeight, 150, endAngle, startAngle, 1);
CGContextAddPath(context, path);
[[colorArr objectAtIndex:i % [valueArr count]] setFill];
[[UIColor colorWithWhite:0.9 alpha:1.0] setStroke];
CGContextDrawPath(context, kCGPathFill);
[[UIColor colorWithWhite:0.1 alpha:0.4] setFill];
CGContextAddPath(context, path);
CGContextDrawPath(context, kCGPathFill);
}
//整体渐变
CGFloat componets [] = {0.0, 0.0, 0.0, 0.5,0.0,0.0,0.0,0.1};
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
CGGradientRef gradient = CGGradientCreateWithColorComponents(colorspace, componets, nil, 2);
CGContextDrawRadialGradient(context, gradient, CGPointMake(160,230), 0, CGPointMake(160,230), 150, 0 );
CFRelease(colorspace);
CGGradientRelease(gradient);
CGContextRestoreGState(context);
//绘制文字
for(int i = 0; i< [valueArr count]; i++)
{
float origionx = 50 ;
float origiony = i * 30 + 200;
[[colorArr objectAtIndex:i % [valueArr count]] setFill];
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>