gpt4 book ai didi

ios - 如何在核心图中设置绘图委托(delegate)

转载 作者:行者123 更新时间:2023-11-29 11:04:53 27 4
gpt4 key购买 nike

这是来自此链接的后续问题:coreplot bar tap not working答案是:Set the plot delegate to your bar plot delegate object.请谁能告诉我怎么做。我正在尝试创建一个简单的条形图,点击 10 天,但没有教程用简单的语言解释了这个过程。这将是一个很大的帮助,我将非常感激。提前致谢。

最佳答案

您需要设置 CPTBarPlot 委托(delegate)。在设置之前,CPTBarPlot 对象不知道将它的委托(delegate)方法发送到哪里。

GraphView.m

寻找 plot.dataSource = self 并添加行 plot.delegate = self(它在您创建 CPTBarPlot *plot< 的代码中)

然后一定要在GraphView.m中添加delegate方法实现

这应该可行,但值得指出的是,您不应该真的将数据源和委托(delegate)方法放在您的 View 中。这是 View Controller 的工作,因为 Controller 在 View 及其模型之间进行调解,并指导用户交互。同样,你的 generateData 方法不属于 View ,数据应该通过 View Controller 设置/发送到 View (我猜它只是为了测试目的,但最好按照你的意思开始继续……)。

关于ios - 如何在核心图中设置绘图委托(delegate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14121683/

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