Iphone UITableViewCell背景色未从UIView子类设置

Iphone UITableViewCell背景色未从UIView子类设置,iphone,ios,objective-c,uitableview,Iphone,Ios,Objective C,Uitableview,我将代码从ViewController移到UIView子类中。视图层次结构保持不变(实际上,我所做的只是将代码从ViewController移动到子类,并将TableView重新连接到故事板中的子类) 现在,我的UITableViewCells的背景色不显示。 我正在这样做: -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPat

我将代码从ViewController移到UIView子类中。视图层次结构保持不变(实际上,我所做的只是将代码从ViewController移动到子类,并将TableView重新连接到故事板中的子类)

现在,我的UITableViewCells的背景色不显示。 我正在这样做:

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if ([tableView isEqual:self.prizeTable]) {
if (indexPath.section == 0) {
  if (indexPath.row % 2 == 0) {
    [cell setBackgroundColor:[LCAppDelegate colorFromHexString:PayoutTableRow2BGColor]];
  } else {
    [cell setBackgroundColor:[LCAppDelegate colorFromHexString:PayoutTableRow1BGColor]];
  }
}
}
}
这段代码正在被调用,但不知怎的,当调用CellForRowatineXpath时,颜色为空。 即使在CellForRowatineXpath中再次设置颜色也不起作用


奇怪的是,如果我滚动表格,颜色会出现在隐藏行和暴露行上。

如果使用“正常”颜色:[cell setBackgroundColor:[UIColor redColor]];不起作用?尝试在dequereusablecell之后添加相同的代码@CellForRowatineXpath