I am wondering how one might animate a CALayer's bounds so, on each bounds change, the layer calls drawInContext:
. I've tried the 2 following methods on my CALayer subclass:
needsDisplayOnBoundsChange
to YES
YES
for the + (BOOL)needsDisplayForKey:(NSString*)key
for the bounds
keyNeither work. CALayer seems determined to use the layer's original contents and simply scale them according to contentsGravity
(which, I assume, is for performance.) Is their a workaround for this or am I missing something obvious?
EDIT: And, incidentally, I noticed that my custom CALayer
subclass is not calling initWithLayer:
to create a presentationLayer
- weird.
Thanks in advance, Sam
You can use the technique outlined here: override CALayer's +needsDisplayForKey:
method and it will redraw its content at every step of the animation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With