Hello,
I am trying to draw in a custom UITableViewCell, but I can apparently only draw outside the white rounded rectangle that usually defines the cell. Anything I try to draw within that space seems to go behind the white shape. Take the following code, for example:
In this case, I can see my green rectangle to the left and to the right of the normal cell, but the white cell itself seems untouched (see the attached image).
What am I doing wrong? How can I draw within my custom cell? Any help would be greatly appreciated. Thanks!
I am trying to draw in a custom UITableViewCell, but I can apparently only draw outside the white rounded rectangle that usually defines the cell. Anything I try to draw within that space seems to go behind the white shape. Take the following code, for example:
Code:
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
CGRect drawRect = CGRectMake(rect.origin.x + 2, rect.origin.y + 2, rect.size.width - 4, rect.size.height - 4);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 0.2, 0.5, 0.2, 0.8);
CGContextFillRect(context, drawRect);
}
In this case, I can see my green rectangle to the left and to the right of the normal cell, but the white cell itself seems untouched (see the attached image).
What am I doing wrong? How can I draw within my custom cell? Any help would be greatly appreciated. Thanks!