添加饼图的代码
pieChart = [[CPTPieChart alloc] init];
pieChart.dataSource = self;
pieChart.pieRadius = 100.0;
pieChart.identifier = @"PieChart1";
pieChart.startAngle = M_PI_4;
pieChart.sliceDirection = CPTPieDirectionCounterClockwise;
pieChart.delegate = self;
self.pieData = [NSMutableArray arrayWithObjects:
[NSNumber numberWithDouble:90.0],
[NSNumber numberWithDouble:60.0],
[NSNumber numberWithDouble:60.0],nil];
[graph addPlot:pieChart];
我想调用以下方法检测饼图上的触摸
-(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endAngle:(CGFloat)endingAngle
答案 0 :(得分:0)
这是一个私有的CPTPieChart方法。公共委托方法的签名是:
-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index;
饼图使用您的数据以及内半径和外半径来确定触摸的切片,并使用切片的索引调用此委托方法。