やるべきことがいくつかあります。
まず、これを円グラフデリゲート関数に実装します。
-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index
{
indexOfPieGraphPlot = index; //gives index of pie which is selected.
isPieGraphPlot = YES; //boolean. if set to yes, will call rootcontroller function which will add pop up.
}
次に、CPTPlotSpaceDelegateを .h ファイルに追加します。
次に、この関数を使用します
- (BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point
{
if(isPieGraphPlot) //if yes call showpopup of rootcontroller
{
isPieGraphPlot = NO;
[rootController showPopUpView:point indexForPlot:indexOfPieGraphPlot];
// point gives the x,y of the pie over which you want a pop up.
}
else // if no then call remove popup from rootcontroller. this, incase user clicks anywhere else in graph.
{
[rootController removePopUp];
}
return YES;
}