为什么对象出现在动画之前
Why does the object appear before animation
我在我的 xcode
项目中实现了 corePlot
。我使用饼图,并尝试像这样制作动画:
[CPTAnimation animate:pieChart property:@"endAngle" from:pieChart.startAngle + M_PI * 2 to:pieChart.startAngle duration:2.0];
它的动画很好,但问题是,一旦图表应该显示,(在动画之前)图表显示一瞬间然后消失并开始动画。
我怎样才能让它开始播放动画而不事先出现?
更新
完整代码如下:
CPTGraph *graph = self.hostView.hostedGraph;
self.pieChart = [[CPTPieChart alloc] init];
self.pieChart.dataSource = self;
self.pieChart.delegate = self;
self.pieChart.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;
self.pieChart.identifier = graph.title;
self.pieChart.endAngle = self.pieChart.startAngle;
self.pieChart.pieInnerRadius = self.pieChart.pieRadius / 2;
配置绘图时,将初始 endAngle
设置为与 startAngle
相同的值。 NAN
的默认值告诉绘图从 startAngle
.
开始绘制一个完整的圆
我在我的 xcode
项目中实现了 corePlot
。我使用饼图,并尝试像这样制作动画:
[CPTAnimation animate:pieChart property:@"endAngle" from:pieChart.startAngle + M_PI * 2 to:pieChart.startAngle duration:2.0];
它的动画很好,但问题是,一旦图表应该显示,(在动画之前)图表显示一瞬间然后消失并开始动画。
我怎样才能让它开始播放动画而不事先出现?
更新
完整代码如下:
CPTGraph *graph = self.hostView.hostedGraph;
self.pieChart = [[CPTPieChart alloc] init];
self.pieChart.dataSource = self;
self.pieChart.delegate = self;
self.pieChart.pieRadius = (self.hostView.bounds.size.height * 0.7) / 2;
self.pieChart.identifier = graph.title;
self.pieChart.endAngle = self.pieChart.startAngle;
self.pieChart.pieInnerRadius = self.pieChart.pieRadius / 2;
配置绘图时,将初始 endAngle
设置为与 startAngle
相同的值。 NAN
的默认值告诉绘图从 startAngle
.