subclassed UITableViewCell – backgroundView covers up anything I do in drawRect

You are not really supposed to mix the drawing with your cell like that, you are operating at a lower-level than the UITableViewCell machinery is operating, and this is why you get this problem.

This is just one of the various problems you will end up running into. You will run into other problems as you go down that path, including problems with how the selection works.

The proper approach is to create a custom UIView that contains the code to draw, and then you can addSubView that into your cell’s root view. That will take care of the rendering in the proper order, and wont interfere with the selection system, and will work correctly in this case.

Leave a Comment