当 iPhone 中的视图消失时,如何删除条形图?
我是核心情节的新手。我使用核心图绘制了一个条形图。我想在视图消失后删除使用核心图绘制的条形图,并在视图出现时使用新值再次绘制。
谁能建议我解决这个问题?
提前致谢, 阿比拉什·G
I am new to core plot. I had drawn a bar chart using core plot. I want to remove the bar chart which I drawn using core plot once the view disappeared and draw once again with the new values when the view appears.
Can anyone suggest me a solution to this?
Thanks in advance,
Abilash.G
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有多种选择,具体取决于您想要达到的效果。
您可以从托管视图中删除图表。新数据准备就绪后,调用
[graph reloadData]
并将图表添加回托管视图。或者扔掉该图表并在需要时创建一个新图表。更好的解决方案是将图表的
visible
属性设置为 NO 以隐藏它,并在您希望它重新出现时返回 YES。如上所述重新加载数据。要仅隐藏条形图而使图形的其余部分可见,您可以调用
[barPlot reloadData]
并且不返回任何数据(绘图的记录数== 0)。当新数据准备就绪时,再次调用-reloadData
。您还可以从图表中删除条形图,并在准备好显示新数据时再次添加新的条形图,尽管上面的#3将为您提供更好的性能。
埃里克
You have several options, depending on the effect you want to achieve.
You can remove the graph from the hosting view. When the new data is ready, call
[graph reloadData]
and add the graph back to the hosting view. Or throw the graph away and make a new one when needed.A better solution would be to set the
visible
property of the graph to NO to hide it and back to YES when you want it to reappear. Reload the data as above.To hide only the bar chart leaving the rest of the graph visible, you can call
[barPlot reloadData]
and don't return any data (number of records for plot == 0). Call-reloadData
again when the new data is ready.You can also remove the bar plot from the graph and add a new one again when you're ready to display the new data, although #3 above will give you better performance.
Eric