I'm trying to determine the best way to use drawRect for something like the cell in the image below and still animate between selected and non-selected states:
I've seen a few suggestions, with the most advanced seeming being this one:
But it still seems pretty hacky, so I'm not quite sold on it. Feels like there has to be a cleaner way.
I suppose another option could be having two different UIViews, one that drew the un-selected state, and one that drew the selected state (the latter probably being a subclass of the former with a slightly different draw rect.) Then you could add both of those to contentView, and hide/fade between them? That wouldn't support edit mode or accessories very well, but maybe that's ok?
Or perhaps you follow that same method, but stick them into backgroundView and selectedBackgroundView respectively?
Or if one respects this cell structure, perhaps you truly only draw the background (the tan I guess in the image above) into the backgroundView, a darker tan into the selectedBackgroundView, and draw everything else in a subclass uiview added to contentView? But then you are drawing in a couple different places (creating your own contexts I would imagine), and still would have issues with the text/decorative images not animating, assuming those changed color.
So what is the answer here?