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

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
Hi All,

I am doing a custom cell view in IPhone

my class is inherited from UITableViewCell

I do custom drawing in drawrect: method.

every thing is fine, but while selection of row, the text does not display !. Is there a way i will be able to show up the text after selection drawing happens ?

- (void)drawRect:(CGRect)rect {
// Drawing code
[self.desc drawAtPoint:CGPointMake(0,0) withFont:[UIFont systemFontOfSize:[UIFont systemFontSize]]];

CGRect drawRect = CGRectMake(100, 5, 50, 10);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(context, 0.5, 1.0, 0.5, 0.8);

CGContextFillRect(context, drawRect);
}
 

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
thanks

thanks but i am doing my custom drawing in drawRect method which is being called before the drawing of selected rectangle [which is done automatically, when i select a cell.]

regards
ch
 

dipaliP

macrumors newbie
Oct 6, 2008
28
0
Instead of writing code in drawRect method you can write code in init method of class referenced from UITableViewCell.

So whenever you will create the object of UITableviewCell' class it will create a custom cell for your table view.

And it will work same as default UITableViewCell even if its custom cell. :)
 

CommanderData

macrumors 6502
Dec 1, 2007
250
3
thanks but i am doing my custom drawing in drawRect method which is being called before the drawing of selected rectangle [which is done automatically, when i select a cell.]

regards
ch

Based on the code you presented here, in your drawRect routine you draw some text and then promptly cover it up with a filled rectangle. Or so it seems... That's what PhoneyDeveloper was getting at :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.