请指导我如何通过单手指触摸(时钟和反时钟)方向旋转CPTGraphHostingView
谢谢
最佳答案
//我已经使用此代码旋转饼图几秒钟而无需用户干预。
-(void)ConstPieChart
{
graph = [[CPXYGraph alloc] initWithFrame: CGRectZero];
viewGraphHostingPie.hostedGraph=graph;
CPPieChart *pieChart = [[CPPieChart alloc] init];
pieChart.dataSource = self;
pieChart.delegate = self;
pieChart.pieRadius = 100.0;
pieChart.identifier = @"PieChart1";
pieChart.startAngle=0;
//pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPPieDirectionCounterClockwise;
NSMutableArray *ValueArray = [[NSMutableArray alloc]init];
ValueArray = [NSArray arrayWithObjects:[NSNumber numberWithDouble:57.03],[NSNumber numberWithDouble:66.00],[NSNumber numberWithDouble:77.03],nil];
self.pieData = ValueArray;
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform"];
CATransform3D transform = CATransform3DMakeRotation(360, 0, 0, 1);
rotation.toValue = [NSValue valueWithCATransform3D:transform];
rotation.duration = 15.0f;
[pieChart addAnimation:rotation forKey:@"rotation"];
[graph addPlot:pieChart];
[pieChart release];
}