He i'm working on simple pie chart, and i've got problem when i'm drawing it. I want to change color of every piece of pie chart, but when method drawRect: is called my pie chart is in signle color. How make it correctly?
for (int i = 0; i < [values count]; i++) {
CGContextSetRGBFillColor(ctx, 0.2*i, 0.2*i, 0.2*i, 1);
[bezierPath moveToPoint:chartCenter];
startAngle = endAngle;
endAngle = startAngle + [self degreesToRadians:[values[i] floatValue]*step];
NSLog(@"%.2f, %.2f", startAngle, endAngle);
[bezierPath addArcWithCenter:chartCenter radius:radius startAngle:startAngle endAngle:endAngle clockwise:1];
[bezierPath addLineToPoint:chartCenter];
[bezierPath fill];
}