当触摸任何一个小鼠时,请参阅旋转饼图的代码:
-(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首先点击饼图旋转,但在后续点击中没有任何反应。
答案 0 :(得分:0)
不是旋转整个绘图图层,而是仅为startAngle
属性设置动画。我怀疑命中检测代码被旋转的坐标系弄糊涂了。