如何在 Core Plot 中为条形图的外观设置动画?
当第一次使用 Core Plot 显示条形图时,我希望条形向上生长,直到达到正确的高度。
您将如何使用这个框架创建这样的动画?
When first displaying a bar chart using Core Plot, I'd like the bars to grow upward until they reach their correct heights.
How would you create such an animation using this framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这就是我所做的:
在我的 viewDidLoad 控制器的方法中,我创建了 CPTXYGraph:
我向空图表添加了动画:
然后在animationDidStop 委托的方法中,我向图表添加了绘图数据和动画:
This is what I did:
In my viewDidLoad controller's method I created the CPTXYGraph:
I added animation to the empty graph:
Then in animationDidStop delegate's method I added the plot data and animation to the graph:
为 CPTBarPlot 添加动画,如下所示:
Add animation for your CPTBarPlot as follows:
感谢米歇尔的精彩回答。
我已将她的回答中的示例上传到 Github,供那些想要下载演示并立即开始工作的人使用!
https://github.com/mayuur/CoreplotAnimation
享受编码吧!
Thanks Michele for your great answer.
I have uploaded an example from her answer to Github for those who would want to download the demo and start working right away!
https://github.com/mayuur/CoreplotAnimation
Enjoy Coding!!!
这非常类似于:如何对使用 core-plot 库开发饼图?
This is very similar to: How to animate the pie charts developed using core-plot library?
像这样添加不透明动画...
Add opacity animation like this...