来自CPTScatterPlot Delegate的plotSymbolWasSelectedAtRecordIndex

时间:2013-11-12 14:07:24

标签: ios

如何从CPTScatterPlot Delegate方法连接plotSymbolWasSelectedAtRecordIndex。当我点击散点图的索引时,它不会渲染到该方法。为什么?拜托,谢谢你,谢谢你。

1 个答案:

答案 0 :(得分: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
}