0
我有以下的代码来创建一个单元格背景图作为一个圆角矩形:动态更改单元格的backgroundView.backgroundColor
- (UIView *)createBackgroundView
{
CGRect background = CGRectMake(50, 25, self.frame.size.width - 60, 90);
UIView *backgroundView = [[UIView alloc] initWithFrame:background];
backgroundView.backgroundColor = [UIColor colorWithRed:0.78 green:0.96 blue:0.39 alpha:1];
[backgroundView.layer setCornerRadius:7.0f];
[backgroundView.layer setMasksToBounds:YES];
return backgroundView;
}
后来在我要更新的backgroundView的的backgroundColor程序,我试过
cell.backgroundView.backgroundColor = [UIColor redColor];
在cellForRowAtIndexPath和willDisplayCell中都没有看到更新它。