Subclassing TableViewCell, backgroundView and selectedBackgroundView mystifying me
I'm subclassing UITableViewCell and using Quartz 2D to draw the elements of the cells in the drawContent view method. In my table view delegate's tableView:cellForRowAtIndexPath, I'm also inserting a UIImageView as a subview to the cell, but the image doesn't appear until the cell is selected. I'm suspicious of the backgroundView and selectedBackground view here, but I'm not sure what I can do to ensure the image is always visible. Here's what it looks like when then cell is selected...
alt text http://www.irovr.com/stackoverflow/tableviewcell.png
开发者_如何转开发I want it to also look this way when the cell isn't selected, but it currently appears as black. My table view background color is black. The cell's background is clear.
Figured it out. I was adding the image to the overall table cell view. I had to add a new view property to my subclass and insert it at the 0 index. Otherwise, the superclass was laying out the views the way it was designed to and interfered with my image.
精彩评论