【问题标题】:Rotate pie chart which is a CALayer with touch events旋转饼图,这是一个带有触摸事件的 CALayer
【发布时间】:2011-07-22 09:56:30
【问题描述】:

我正在使用 core-plot 绘制饼图。我在 CPTPieChart.h 的触摸拖动事件中使用此代码。

   -(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint{
         int x = self.anchorPoint.x;
         int y = self.anchorPoint.y;
         float dx = interactionPoint.x - x;
         float dy = interactionPoint.y - y;
         double a = atan2(dx,dy);
         self.transform = CATransform3DMakeRotation(a, 0, 0, 1);
         return YES;
    }

饼图正在轻微旋转,但顶部和底部在旋转时被剪裁。 任何帮助将不胜感激。谢谢!

【问题讨论】:

  • 图表上是否设置了任何填充?
  • 我没有设置任何填充。我需要设置吗?谢谢。
  • 您可能不需要填充。我只是在猜测什么可以剪辑情节。有什么方法可以发布您的图表设置代码和/或图片?

标签: iphone ios ios4 core-animation core-plot


【解决方案1】:

我在使用transform = CATransform3DMakeRotation(a, 0, 0, 1) 旋转CPTPieChart 时遇到了同样的裁剪问题。不完全确定是什么原因造成的。

我通过更改 startAngle 属性而不是 transform 属性来解决这个问题。

见:http://groups.google.com/group/coreplot-discuss/browse_thread/thread/4372a7590c474c85

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-01
    • 2011-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多