0

如何从 CPTScatterPlot Delegate 方法连接 plotSymbolWasSelectedAtRecordIndex。当我单击散点图的索引时,它不会呈现给该方法。为什么?你能帮我吗?谢谢

4

1 回答 1

0

确保您首先采用该协议。因此,在您的.h文件中声明如下:

#import "CorePlot-CocoaTouch.h"
// CPTPlotSpaceDelegate is optional, used for other things, and of course CPTPlotDataSource is mandatory, and for your purpose, CPTScatterPlotDelegate is also mandatory
@interface ViewController : UIViewController <CPTPlotSpaceDelegate, CPTPlotDataSource, CPTScatterPlotDelegate> { 

}

在你的.m文件中:

self.linePlot = [[CPTScatterPlot alloc] init];
self.linePlot.delegate = self;

-(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index {
    // Your logic here
}
于 2013-11-12T14:53:39.067 回答