为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月前
|
监控 计算机视觉
指定的颜色范围过滤出特定颜色的区域
指定的颜色范围过滤出特定颜色的区域
36 5
|
10月前
Range滑动条颜色分区问题
Range滑动条颜色分区问题
63 1
table怎么实现部分列固定宽度,其它列宽自适应拉伸
table怎么实现部分列固定宽度,其它列宽自适应拉伸
401 0
table怎么实现部分列固定宽度,其它列宽自适应拉伸
126.设置填充类型和填充颜色
126.设置填充类型和填充颜色
66 0
【Eachat】关于设置多个折线图时,y轴的数据对不上
【Eachat】关于设置多个折线图时,y轴的数据对不上
581 0
【Eachat】关于设置多个折线图时,y轴的数据对不上
tableView 去掉底部多余的cell线(记录备忘)
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
797 0