gpt4 book ai didi

ios - 在 CPTXYGraph 饼图上获取触摸反馈

转载 作者:行者123 更新时间:2023-12-01 15:45:29 26 4
gpt4 key购买 nike

我正在使用 Core Plot 中的 CPTXYGraph 绘制饼图。我使用了委托(delegate)方法

-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index

在单击饼图的特定部分时执行某些操作。但是当我触摸饼图时,我需要有一个反馈或某种类型的图像变化来显示,以表示特定的切片被触摸,就像按钮事件一样。

是否有任何委托(delegate)方法可以实现相同的目的。

最佳答案

还有一些工作要做。

首先,将其实现到饼图委托(delegate)函数中。

-(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index
{
indexOfPieGraphPlot = index; //gives index of pie which is selected.
isPieGraphPlot = YES; //boolean. if set to yes, will call rootcontroller function which will add pop up.
}

然后在.h文件中添加CPTPlotSpaceDelegate

然后使用这个函数

- (BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point
{
if(isPieGraphPlot) //if yes call showpopup of rootcontroller
{
isPieGraphPlot = NO;
[rootController showPopUpView:point indexForPlot:indexOfPieGraphPlot];
// point gives the x,y of the pie over which you want a pop up.
}
else // if no then call remove popup from rootcontroller. this, incase user clicks anywhere else in graph.
{
[rootController removePopUp];
}
return YES;
}

关于ios - 在 CPTXYGraph 饼图上获取触摸反馈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11356594/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com