Hi, I am trying to draw strings in a UITableViewCell in iOS 7 with the following code
-(void)drawRect:(CGRect)rect{ [super drawRect:rect]; CGRect playerNameRect = CGRectMake(0, kCellY, kPlayerNameSpace, kCellHeight); NSDictionary*dictonary = [NSDictionary dictionaryWithObjectsAndKeys: [UIColor hmDarkGreyColor], NSForegroundColorAttributeName, kFont, NSFontAttributeName, nil]; [self.playerName drawInRect:playerNameRect withAttributes:dictonary]; }
However, I cannot make something appear ... self.playerName is not nil, and playerNameRect is correct.
I used the following code earlier to do the same, but recently deprecated in iOS 7
[self.playerName drawInRect:playerNameRect withFont:kFont lineBreakMode:NSLineBreakByTruncatingTail alignment:NSTextAlignmentCenter];
It is also strange that I cannot get anything to draw drawRect on a UITableViewCell ... Deprecated code works when I draw a Rect only on a UIView.
source share