I have an iOS app with a table view. One problem I am having is that I cannot set the cell background colour with a custom RGB colour.
For example, this will work:
// Set the background colour.
[cell contentView].backgroundColor = [UIColor redColor];
However this on the other hand will not work:
// Set the background colour.
[cell contentView].backgroundColor = [UIColor colorWithRed:(54/255.0) green:(215/255.0) blue:(183/255.0) alpha:1.0];
I don't get why its so darn hard to just set one blumming background colour!... :(
I am really frustrated about this because I have tried quite a few different approaches including:
- Adding a custom
UIViewto the background of my cell and setting its background colour. - Have tried setting this property in the
willDisplayCellmethod. - Have tried both the
cell.backgroundColorandcell.contentViewand neither will work.
Does the UITableView not support custom RGB colours or something?