Core Plot CPTBorderedLayer not animating

81 views Asked by At

I have a CPTPlotSpaceAnnotation whose contentLayer property is a CPTBorderedLayer object. I'm trying to animate the CPTBorderedLayer object with the following:

CGRect originalBounds = annotation.contentLayer.bounds;
CGRect expandedBounds = annotation.contentLayer.bounds;
expandedBounds.size.width *= 1.5f;
expandedBounds.size.height *= 1.5f;

CABasicAnimation* boundsAnimation = [CABasicAnimation animationWithKeyPath:@"bounds"];
boundsAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
boundsAnimation.fromValue = [NSValue valueWithCGRect:originalBounds];
boundsAnimation.toValue = [NSValue valueWithCGRect:expandedBounds];
boundsAnimation.duration = 1.0f;
boundsAnimation.removedOnCompletion = NO;

[annotation.contentLayer addAnimation:boundsAnimation forKey:@"bounds"];

But this isn't animating. Setting the bounds directly to expandedBounds works, but it won't animate. Thoughts?

1

There are 1 answers

0
mistershoe On BEST ANSWER

The issue was that I had the collapsesLayers property on my CPTGraphHostingView set to YES. Setting it to NO fixed the issue.