views:

42

answers:

1

I want to use -drawRect: in an UITableViewCell subclass but it is covered by contentView. So the best option seems to be that I make a UIView subclass with my -drawRect: code and use that as contentView. But how could I feed my UITableViewCell subclass with that contentView?

UITableViewCell creates that on its own when the contentView property is accessed. Would I simply override the getter method and then provide my own view there?

A: 

Make a subclass of UIView and implement your drawing code in this objects drawRect method. Add this subclass to the contentView of the cell upon initialisation.

[cell.contentView addSubview:customView];

No need to modify the cell's drawRect method.

Kenny