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?
The issue was that I had the
collapsesLayers
property on myCPTGraphHostingView
set toYES
. Setting it toNO
fixed the issue.