Iphone 如何在Core Plot饼图中启用截面的触摸选择?
我正在使用Core Plot框架绘制饼图,并且在绘制饼图本身时没有任何问题 但是,我需要饼图在本质上是交互式的,即,如果我点击饼图中的任何特定部分,它将触发导航到显示该特定部分详细信息的页面Iphone 如何在Core Plot饼图中启用截面的触摸选择?,iphone,ios,core-plot,Iphone,Ios,Core Plot,我正在使用Core Plot框架绘制饼图,并且在绘制饼图本身时没有任何问题 但是,我需要饼图在本质上是交互式的,即,如果我点击饼图中的任何特定部分,它将触发导航到显示该特定部分详细信息的页面 我尝试使用方法-(void)pieChart:sliceWasSelectedAtRecordIndex:,但从未调用该委托方法。我需要什么来启用这种触摸交互?我已经在我的iPad应用程序中使用CorePlot 0.2.2实现了饼图选择。你猜怎么用 (无效)pieChart:Slicewasselected
我尝试使用方法
-(void)pieChart:sliceWasSelectedAtRecordIndex:
,但从未调用该委托方法。我需要什么来启用这种触摸交互?我已经在我的iPad应用程序中使用CorePlot 0.2.2实现了饼图选择。你猜怎么用
(无效)pieChart:Slicewasselected Trecordindex:是正确的,但可能您已经忘记了
声明以下两件事:
- 您的控制器是否声明了CPPieChartDelegate协议
- 你有没有告诉饼图你的控制器是它的代表
@interface YourViewController : UIViewController < CPPieChartDataSource,
CPPieChartDelegate,
... >
{
...
CPXYGraph* pieGraph;
CPGraphHostingView* pieView;
}
@property (nonatomic, retain) IBOutlet CPGraphHostingView* pieView;
- (void)pieChart:(CPPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index;
@end
使用上一个
corePlot框架(1.4)
我找不到CPPieChart
,但我修复了cptpiechartdegate
:
@interface CPDFirstViewController : UIViewController <CPTPlotDataSource, CPTPieChartDelegate, ...>
使用CorePlot 1.4
希望能有帮助
dom核心绘图类前缀从“CP”更改为“CPT”。谢谢:如果你在谷歌上搜索“corePlot examples”,你可能会遇到旧的示例或旧的讨论线程。希望这封信能帮助“iOS学习者”(像我一样;-))
@interface CPDFirstViewController : UIViewController <CPTPlotDataSource, CPTPieChartDelegate, ...>
-(void)pieChart:(CPTPieChart *)pieChart sliceWasSelectedAtRecordIndex:(NSUInteger)index
{
// Put your action here
}