2011-11-29 108 views

回答

1

如果你想要一个不同的颜色表和单元格的,只是说tableView.backgroundColor = desiredColor。类别UIColor提供类别方法,如+blueColor,+redColor等。

如果你想表及其细胞相同的颜色,保持上面的代码并添加这tableView:cellForRowAtIndexPath:

// Customize the cell 
cell.backgroundColor = [UIColor clearColor]; 
for (UIView *subview in [cell subviews]) { 
    subview.backgroundColor = [UIColor clearColor]; 
} 

这比简单地说cell.backgroundColor = desiredColor,因为如果你决定使用视图一个更好的解决方案(如图案),而不仅仅是一种颜色,作为表格的背景,背景将始终可见,而不仅仅是当您弹跳内容时。

+0

@ user1071621请记住投票接受答案。 – aopsfan

0

tableView.backgroundColor = [UIColor yellowColor]

相关问题