iphone - Drawing text in UITableViewCell -
i used following method draw text in custome cell, it's working fine found part of text missing(not showing text in cell):
- (void)drawcontentview:(cgrect)rect { uicolor * textcolor = [uicolor blackcolor]; if (self.selected || self.highlighted){ textcolor = [uicolor whitecolor]; } else { [[uicolor whitecolor] set]; uirectfill(self.bounds); } [textcolor set]; uifont * textfont = [uifont systemfontofsize:16]; cgsize textsize = [text sizewithfont:textfont constrainedtosize:rect.size]; [text drawinrect:cgrectmake(self.frame.size.width-(textsize.width+2 ) , (rect.size.height / 2) - (textsize.height / 2), textsize.width, textsize.height) withfont:textfont linebreakmode:nslinebreakbywordwrapping alignment:nstextalignmentright]; } thanks, please advice.
try make space drawing bigger textsize.width, textsize.heigh
uifont * textfont = [uifont systemfontofsize:16]; cgsize sizeme = cgsizemake(300, rect.size.height*1.5); cgsize textsize = [text sizewithfont:textfont constrainedtosize:sizeme]; [text drawinrect:cgrectmake(self.frame.size.width-(textsize.width+10 ) , (rect.size.height / 2) - (textsize.height / 2), textsize.width, textsize.height+(textsize.height*1.5)) withfont:textfont linebreakmode:nslinebreakbywordwrapping alignment:nstextalignmentright];
Comments
Post a Comment