TableView Cell colour can't be changed.

Hello all,

I'm trying to change TableView Cell background colour from interface builder.
I've set background colour in storyboard, that colour is visible in storyboard, but in the runtime cell background colour is still white.


What am I doing wrong?
Thanks in advance!
I created a new project and tested with Xcode 12.1 and the background color of the prototype cell is shown in runtime as I set in InterfaceBuilder.
  • I created a new UIKit project.

  • Added UITableView to the main view of ViewController in IB

  • Added a Prototype Cell to the UITableView in IB (Reuse Identifier: Cell)

  • Set the background color of the Prototype Cell in IB

  • Added an IBOutlet for the UITableView as tableView

  • Implemented the UITableViewDatasource methods (Using "Cell" as identifier)

That's all.

Can you describe how you have set background colour in storyboard in detail?
Accepted Answer
Is it a custom cell with its own nib ?
I tested, it works

Is it a standard cell, with title, …
I tested, works as well.

Do you change the cell background or its content view (level below in hierarchy). Result is different (for instance, the second does not change color behind disclosure button).

So please explain the detail of what you are doind and show possibly code.
I was trying to change Section Index background colour..
Thank you all!


TableView Cell colour can't be changed.
 
 
Q