Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Turias

macrumors newbie
Original poster
Nov 17, 2003
23
1
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:

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!
 

Attachments

  • Picture 2.png
    Picture 2.png
    5.1 KB · Views: 4,122

Turias

macrumors newbie
Original poster
Nov 17, 2003
23
1
Actually, I think it's because I need to get the UIButton object out of the UITableViewCell and draw in that. Doh! Too much coding, today...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.