核心情节显示“加载”;旋转器

发布于 2024-12-06 17:19:31 字数 243 浏览 0 评论 0原文

我正在使用核心图(0.4)来渲染图表,它工作正常。然而(尤其是在 iPad 上)图表可能需要一段时间才能渲染。我已在图表中添加了一个 UIActivityIndi​​catorView,该视图在开始绘制图表时显示,但我找不到任何可用于停止旋转器的事件。

我尝试使用 numberForPlot 方法并检测何时请求最后一个数据点,但是对于 scatterGraph 上的每一行都会多次调用该方法,因此我无法轻松使用它。我可以为此挂钩任何类型的图形渲染事件吗?

I am using core plot (0.4) to render a graph and it is working fine. However (especially when on the iPad) the graph can take a while to render. I have added a UIActivityIndicatorView to the graph which shows up when the graphs starts to be drawn, but I can't find any event to hook that I can use to stop the spinner.

I have tried using the numberForPlot method and detecting when the last datapoint has been requested, but this is called multiple times for each line on the scatterGraph, so I can't easily use this. Is there any sort of graph rendered event that I can hook for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘年祭陌 2024-12-13 17:19:31

如果您正在执行[graph reloadData]来更新图表,您可以将该调用与指标开始/停止调用括起来吗?我认为核心情节在主线程中完成了所有事情。

If you're doing [graph reloadData] to update the graph, can you just bracket that call with your indicator start/stop calls? I think that core-plot does everything in the main thread.

烧了回忆取暖 2024-12-13 17:19:31

Core Plot 使用 Core Animation 进行所有渲染。单个图包含许多独立渲染的 CA 层。 -reloadData 只是告诉图形在下次绘制时更新其数据缓存,并告诉 Core Animation 它需要重新绘制。同样,仅将数据源调用括起来仅捕获渲染之前发生的数据缓存。您会错过实际的绘制时间,并且永远不会知道 Core Animation 是否在其他时间重新渲染图形,例如在调整大小之后。

如果您只关心渲染绘图的时间而不关心图形的其他部分,则一种方法是子类化 CPTScatterPlot 并覆盖 -renderAsVectorInContext:方法。将对 super 的调用与您的活动指示器代码括起来。

Core Plot uses Core Animation for all rendering. A single graph contains many CA layers that are rendered independently. -reloadData just tells the graph to update its data cache next time it draws and tells Core Animation that it needs to be redrawn. Similarly, just bracketing the data source calls only captures the data caching that happens before the render. You would miss the actual drawing time and would never know if Core Animation re-rendered the graph at another time, such as after a resize.

If you only care about the time to render the plot and not the other parts of the graph, one way to do this would be to subclass CPTScatterPlot and override the -renderAsVectorInContext: method. Bracket the calls to super with your activity indicator code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文