【问题标题】:Piechart not rotating on tap in Coreplot- iOS在 Coreplot-iOS 中,饼图不旋转
【发布时间】:2012-11-23 09:25:08
【问题描述】:

请参考旋转饼图的代码当触摸任何sice时:

-(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];

}

第一次点击饼图旋转,但在随后的点击中没有任何反应。

【问题讨论】:

    标签: core-animation core-plot


    【解决方案1】:

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

    【讨论】:

    • startAngle 基于什么?我假设 0-360º(0 是“西”),但这似乎不正确。
    • 它使用标准的极坐标系——角度以弧度为单位,向右(东)为零。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    • 2012-11-04
    • 1970-01-01
    相关资源
    最近更新 更多