如何从CPTScatterPlot Delegate方法连接plotSymbolWasSelectedAtRecordIndex。当我点击散点图的索引时,它不会渲染到该方法。为什么?拜托,谢谢你,谢谢你。
答案 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
}