Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPad: unable to set background color of custom cell in split view

I was trying to set the background color of a customized cell but background color is not displayed.

 ProjectListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[ProjectListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}

// Configure the cell...

if((indexPath.row%2)!=0)
{

    [cell setBackgroundColor:[UIColor redColor]];
}
else 
{

    [cell setBackgroundColor:[UIColor greenColor]];
}

Is this because of splitview.

like image 582
Ankit Sachan Avatar asked Mar 04 '11 10:03

Ankit Sachan


1 Answers

Try to use cell.contentView.backgroundColor or cell.backgroundView.backgroundColor instead.

like image 130
Max Avatar answered Nov 12 '22 17:11

Max