根据例子建议我应该覆盖drawContentView 如果我想在单元格中添加一些UIView。你能告诉我一些例子吗?
- (void)drawContentView:(CGRect)rect {
UIColor * textColour = [UIColor blackColor];
if (self.selected) {
textColour = [UIColor whiteColor];
[[UIImage imageNamed:@"selectiongradient.png"] drawInRect:rect];
}
[textColour set];
UIFont * textFont = [UIFont boldSystemFontOfSize:22];
CGSize textSize = [text sizeWithFont:textFont constrainedToSize:rect.size];
[text drawInRect:CGRectMake((rect.size.width / 2) - (textSize.width / 2),
(rect.size.height / 2) - (textSize.height / 2),
textSize.width, textSize.height)
withFont:textFont];
}