Change color of alternate row in UITableView for iPhone SDK
ios, objective-c, uitableview
Solution
- (void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath
{
if(indexPath.row % 2 == 0)
cell.backgroundColor = [UIColor redColor];
else
cell.backgroundColor = [UIColor whiteColor];
}
Problem
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.