Animating CALayer's shadowPath property
Firstly, you did not set the animation's fromValue
.
Secondly, you're correct: toValue
accepts a CGPathRef
, except it needs to be cast to id
. Do something like this:
theAnimation.toValue = (id)[UIBezierPath bezierPathWithRect:newRect].CGPath;
You'll also need to set the shadowPath
property of the layer explicitly if you want the change to remain after animation.