In iOS 7, when a UIActionSheet
is presented, the system controls all animate their tintColor
to gray. When the sheet is dismissed, they animate back.
I have some controls with custom background images or drawRect
implementations that use the tint color, and I'd like them to animate that change just like the system controls.
Apple added - (void)tintColorDidChange
to UIView
, but redrawing with the new color in this method doesn't animate the change — it just switches from full color to full gray immediately, which looks bad when other system controls around it are animating.
How can I make my custom-drawn controls animate the tintColor
transition like Apple's?
Best Answer
You can do this with a Core Animation transition applied to the view layer:
EDIT: there may be a race condition between the animation and the redraw depending on exactly how you do the redraw. If you can post the original redraw code you tried that updated immediately (without animation) I can provide a more specific answer.