简体   繁体   中英

UITableViewController Background Color

I'm struggling getting the color behind the UITableView to be the gray I want. The background of the UITableView seems to be working fine, but the area behind it still remains white?

在此处输入图片说明

here is the end of my view. There is only one cell in this and its not a cropped image. I'm using a UITableViewController so I've set the background of the table view and all the cells. But still the area above (when you pull to refresh) and the area below are white.

Actually you have to set the gray you want as the background color of the UITableViewCell.

Set the backgroundColor property:

cell.backgroundColor = [UIColor grayColor];

Note that the backgroundColor must be set in the tableView:willDisplayCell:forRowAtIndexPath: method.

Its hard to judge with whatever you have mentioned in your question. If the background color of tableView is working fine as per your expectation then could you please try setting clear color for your cells for them to use tableView's color. I hope this should work and if not then could you please share the code of your view controller for us to have a closure look on whats happening.

cell.backgroundColor = [UIColor clearColor];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM