为UITableView的列设置间隔颜色

简介:

为不同的列设置间隔颜色(alternate color ),可以方便用户观看app的内容,在UTTableView中设置间隔颜色需要重写下面的willDisplayCell:forRowAtIndexPath方法

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

    if( [indexPath row] % 2) {

        [cell setBackgroundColor:[UIColorwhiteColor]];

    }

    else {

        [cell setBackgroundColor:[UIColorgrayColor]];

    }

}


    本文转自Jake Lin博客园博客,原文链接http://www.cnblogs.com/procoder/archive/2012/12/29/UITableView-alternate-color.html:,如需转载请自行联系原作者


相关文章
|
2月前
|
开发工具
如何设置单元格的填充颜色?
【10月更文挑战第22天】如何设置单元格的填充颜色?
78 2
Range滑动条颜色分区问题
Range滑动条颜色分区问题
120 1
table怎么实现部分列固定宽度,其它列宽自适应拉伸
table怎么实现部分列固定宽度,其它列宽自适应拉伸
527 0
table怎么实现部分列固定宽度,其它列宽自适应拉伸
126.设置填充类型和填充颜色
126.设置填充类型和填充颜色
95 0
ECharts给柱状条设置不同的颜色且给坐标轴名设置不同颜色
ECharts给柱状条设置不同的颜色且给坐标轴名设置不同颜色
639 0
ECharts给柱状条设置不同的颜色且给坐标轴名设置不同颜色
C#编程-19:DataGridView属性AutoSizeColumnMode的枚举值(自动列宽)
C#编程-19:DataGridView属性AutoSizeColumnMode的枚举值(自动列宽)
354 0