您的位置:首页 > 移动开发 > IOS开发

ios tableView中在不同行中显示不同的颜色

2014-07-10 15:03 405 查看
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row %
2 == 1){

[cell setBackgroundColor:[UIColor yellowColor]];

}
else{//indexPath.row % 2 == 0

[cell setBackgroundColor:[UIColor lightGrayColor]];

}

[cell setSelectedBackgroundView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cell_bg.png"]]];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: