我已经阅读了很多不同的方法来解决设置 UITableViewCell 颜色的问题。只是在快速确认下面的代码/方法可以重新成为最佳实践/性能观点之后?
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor redColor];
}
与此相关的一些注释/问题:
最佳答案
你是对的,这就是这样做的方法。 UITableViewCell
文档甚至明确指出应该在 tableView:willDisplayCell:forRowAtIndexPath:
中设置背景颜色。而不是 tableView:cellForRowAtIndexPath:
.不要害怕,先生,您走在正确的道路上。
关于iphone - 这段代码可以设置 UITableViewCell 背景颜色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5173601/