Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the color of empty table view cells?

I changed the color of cells from the storyboard (did not use any code) but as you can see in this image:

enter image description here

empty cells stay white as default. I want to change those empty cells to red also but I am having trouble figuring out. I also in my code setting cell.backgroundColor = [UIColor redColor]; with no success.

like image 934
TKP Avatar asked May 27 '14 02:05

TKP


2 Answers

You just set tableView's backgroundColor: yourTableView.backgroundColor = [UIColor redColor];

like image 83
nmh Avatar answered Sep 19 '22 18:09

nmh


For others who like to use Storyboard, there's not a specific setting to set this, but in the Table View in Storyboard, you can go to the Identity Inspector, enter a "backgroundColor" and set it as the Color type in User Defined Runtime Attributes:

enter image description here

Not sure why this isn't a setting in storyboard, but this works!

like image 34
Peter Hale Avatar answered Sep 18 '22 18:09

Peter Hale