【问题标题】:overlayFill for pieplot with image isn not working properly in coreplot iOS用图像覆盖饼图的覆盖填充在 coreplot iOS 中无法正常工作
【发布时间】:2013-10-24 07:16:17
【问题描述】:

我正在用图像填充 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);

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

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

【问题讨论】:

  • 您在使用 Retina 设备和/或模拟器吗?
  • @EricSkroch:我正在模拟器中测试。
  • 什么模拟器设备?模拟屏幕是不是 Retina (@2x)?
  • @EricSkroch:模拟视网膜。

标签: objective-c core-plot ios6.1


【解决方案1】:

您需要设置图像填充的scale,以便正确绘制。你可以在创建CPTImage时做到这一点:

UIImage *image = [UIImage imageNamed:@"pointerPie.png"];
piePlot.overlayFill = [CPTFill fillWithImage:[CPTImage imageWithCGImage:image.CGImage
                                                                  scale:image.scale]];

【讨论】:

  • 我按照你的建议做了同样的事情,但还是有同样的问题。
  • @MonishKumar 你能张贴截图吗?我的回答解决了 Core Plot 图像的一个常见问题。我无法从您的描述中看出还有什么问题。
猜你喜欢
  • 2011-12-11
  • 1970-01-01
  • 1970-01-01
  • 2021-03-03
  • 1970-01-01
  • 1970-01-01
  • 2011-07-13
  • 1970-01-01
  • 2014-03-21
相关资源
最近更新 更多