Chr*_*ina 3 iphone xcode cocoa-touch uitableview ipad
我想为表视图单元格提供替代颜色.例如,第一个单元格颜色保持白色而下一个单元格是浅灰色,然后第三个单元格再次变白,然后接下来又是浅灰色等等.任何人都可以告诉我这样做的方法.
谢谢,克里斯蒂
使用这个christy:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0 || indexPath.row%2 == 0) {
UIColor *altCellColor = [UIColor colorWithRed:100 green:10 blue:10 alpha:1];
cell.backgroundColor = altCellColor;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6331 次 |
最近记录: |