plotSymbolWasSelectedAtRecordIndex from CPTScatterPlot Deleg



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

确保首先采用该协议。因此,在您的.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
}

最新更新