我使用的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