0

我正在用图像填充 piePlot 的叠加层,而不是用渐变颜色填充。

这是代码:

piePlot.pieRadius       = radius;
piePlot.identifier      = @"1";
piePlot.startAngle      = 0.0;
piePlot.sliceDirection  = CPTPieDirectionCounterClockwise;
piePlot.borderLineStyle = [CPTLineStyle lineStyle];
piePlot.labelOffset     = 5.0;
piePlot.overlayFill     = [CPTFill fillWithImage:[CPTImage imageWithCGImage:[UIImage imageNamed:@"pointerPie.png"].CGImage]];
piePlot.centerAnchor    = CGPointMake(0.5, 0.5);

这里的问题只是我可以看到的覆盖图像的一部分,而不是完整图像。如果我用任何其他颜色填充它,它的工作正常。

我在这里做错了什么。谁能建议我在这里做错了什么?

4

1 回答 1

0

您需要设置scale图像填充的,以便正确绘制。您可以在创建时执行此操作CPTImage

UIImage *image = [UIImage imageNamed:@"pointerPie.png"];
piePlot.overlayFill = [CPTFill fillWithImage:[CPTImage imageWithCGImage:image.CGImage
                                                                  scale:image.scale]];
于 2013-10-25T15:43:13.463 回答