views:

468

answers:

1

Hi,

I'm trying to make a UITableViewCell that has a group color panel on the left. The gradient color part I think I can handle, but I can't work out how to get it to clip correctly at the round corners.

I'm after something like this:

Colored Cells

I've tried a custom draw UIView added as a subview of the cell's contentView, but it didn't clip. I've also noticed that UILabels added as sub-views don't clip to the cell boundaries.

Is there's some magic to get these clipped correctly, or do I need to manually do the clipping - and if so is there an easy way for UITableViewCell to know if it's first/last in a section. Any help appreciated.

+1  A: 

You have to do it manually. This has been answered with example code here.

Crufty