I have a view with one sublayer of type CATextLayer. I override the views drawRect: method and in there change the CATextLayer.string property to an instance of NSAttributedString. Each time the NSAttributedString has the same text but with different colors. As of now each time the string property changes, the text color makes an animated transition into the new color.
Is there any way I can disable the animation of this property?
Figured it out, using the answer for this question: Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]
In my particular case, to stop the changing of the CATextLayer.string
property from being animated, this code was enough:
NSDictionary *newActions = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"contents", nil];
textLayer.actions = newActions;
[newActions release];
In other words, it seems that the contents
key disables animations on changes to the CATextLayer.string
property.
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