tresnotas tresnotas - 3 months ago 11
iOS Question

Animating UIButton text color

Is there a way to animate the textColor property of a UIButton? I've found some solutions for UILabel text color animation, but haven't seen any for UIButton.

Answer

NSTimer is absolutely no good as an animation tool, nor should it be used for timekeeping in general where precision is needed (frame rate). This blog post perfectly exemplifies my position on what to do about non-animateable UILabel properties, which should be sent off to the render server through CA, not an NSTimer. Instead of UILabel, you can use or wrap CATextLayer and animate it's foregroundColor property in the standard animation block.