在Coreplot-iOS中,Piechart不能旋转

时间:2012-11-23 09:25:08

标签: core-animation core-plot

当触摸任何一个小鼠时,请参阅旋转饼图的代码:

-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index{

[self rotatePieChart:plot];

}

-(void)rotatePieChart:(CPTPieChart *)plot {    

[CATransaction begin];
{
    CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform"];
    CATransform3D transform = CATransform3DMakeRotation(-45, 0, 0, 1);
    rotation.toValue = [NSValue valueWithCATransform3D:transform];
    rotation.fillMode = kCAFillModeForwards;
    rotation.duration = 1.0f;
    rotation.cumulative=YES;
    rotation.removedOnCompletion = NO; 

    [plot addAnimation:rotation forKey:@"rotation"];

}
[CATransaction commit];

}

ON首先点击饼图旋转,但在后续点击中没有任何反应。

1 个答案:

答案 0 :(得分:0)

不是旋转整个绘图图层,而是仅为startAngle属性设置动画。我怀疑命中检测代码被旋转的坐标系弄糊涂了。