在UITableView for iPhone SDK中更改备用行的颜色 [英] Change color of alternate row in UITableView for iPhone SDK

查看:79
本文介绍了在UITableView for iPhone SDK中更改备用行的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我想在iPad中显示多列tableView。



所以,我使用了cocoa控件: MultiColumn TableView



它适用于我,但我希望以替代颜色显示行。



<为此,我无法找到更改代码的位置。



帮我解决这个问题。

解决方案

请尝试使用它,它会正常工作..

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

if(indexPath.row%2 == 0 )
cell.backgroundColor = [UIColor redColor];
else
cell.backgroundColor = [UIColor whiteColor];
}


In my app, I want to display multi-column tableView in iPad.

So, I used a cocoa control from :MultiColumn TableView

it works fine for me, But I want to display the rows in alternate color.

For this, I am not able to find where I change the code for it.

Help me to solve this Problem.

解决方案

Please try to use this it'll work fine..

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

        if(indexPath.row % 2 == 0)
              cell.backgroundColor = [UIColor redColor];
        else
              cell.backgroundColor = [UIColor whiteColor];
}

这篇关于在UITableView for iPhone SDK中更改备用行的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆