我使用的UITableView
有一个自定义UItableViewCell
。这个自定义单元格有一个子视图(一个UIView子类)。我使用自定义UIView子类的drawRect
来放置单元格显示的所有文本。drawRect不反映对图层所做的更改
而且在drawRect
(的UIView
子类)我做了以下
/*
// This piece of code is called when setNeedsDisplay is called
*/
- (void)drawRect:(CGRect)rect
{
self.layer.cornerRadius = 10.0f;
self.layer.backgroundColor = [[UIColor orangeColor] CGColor];
self.layer.borderColor = [[UIColor lightGrayColor] CGColor];
self.layer.borderWidth = 3.0f;
}
但是我的自定义单元格是一个黑色的方形这样
但我确实看到了预期的行为如果我选择该行。像图所示
怎么回事?
已尝试过,不会工作:-( – GarryO