views:

224

answers:

1

I have a subclass of UIView that draws a number with a border around it using Core Graphics (unread count style). I have this in a UITableViewCell and change the color of the border when setSelected:animated: is called. The problem is that it does not animate the change.

Is there any way on the iPhone to animate the change of Core Graphics drawing. All I want is a simple fade from one state to the other.

+1  A: 

Your best bet might be to add a UIImageView to your UIView subclass. Then you can animate the change of the image like so:

[UIView beginAnimations:nil context:NULL];
[imageView setImage:newImage];
[UIView commitAnimations];

Just hold two images for the different color borders and update them to fit when the numbers change. Should only require a bit of rearranging the drawing code.

David Kanarek
Have you tested this?
Sneakyness
It's been a few months so I don't remember. Are you having trouble with it? I'm pretty sure the documentation lists the animatable properties so that should tell you if it is supposed to work. If you need some help let me know.
David Kanarek