【发布时间】:2012-09-18 16:21:23
【问题描述】:
我使用的UITableView 有一个自定义UItableViewCell。这个自定义单元格有一个子视图(一个 UIView 子类)。我使用自定义 UIView 子类的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;
}
但是我的自定义单元格是这样的黑色方块
但如果我选择该行,我确实会看到预期的行为。如下图所示
怎么了?
【问题讨论】:
标签: iphone objective-c ios cocoa-touch