Question: I am trying to setup a general colour scheme for my app using code so it's easily modified when porting between projects. However, the two colours on these components keep coming out slightly different colours. I use the following code to setup my UITableViewCell:

```
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{    
    if ([indexPath row] %2 != 0)
    {
        [cell setBackgroundColor:kTableSecondaryCellColor];
    }
}

```

and this for my UILabel:

```
[self.lTitleBackground setBackgroundColor:kTableSecondaryCellColor];

```

As you can see I am simply setting the background on both of the elements to kTableSecondaryCellColor which is setup as follows:

```
#define kTableSecondaryCellColor [UIColor colorWithRed:(158.0f / 256.0f) green:(171.0f / 256.0f) blue:(4.0f / 256.0f) alpha:0.4f] 

```

However, the results of the two colours come out as follows (green colour):

![enter image description here](https://i.stack.imgur.com/o7Pqd.png)

![enter image description here](https://i.stack.imgur.com/x4fXk.png)

Answer: 
You must use 

```
cell.contentView.backgroundColor = kTableSecondaryCellColor;

```
```
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{    
    if ([indexPath row] %2 == 0)
    {
        cell.contentView.backgroundColor = kColorTablePrimary;
    }
    else
    {
        cell.contentView.backgroundColor = kColorTableSecondary;
    }
}

```

This is the code I am currently using, the opacity is only being detected on iPhone but I have a breakpoint in this code and it's definitely being called when I use the iPad just the opacity isn't showing. I've been through the setup and the cells are both setup identically, the same with the UITableViews.