[英]How to change UITableView background color
I have the following codes: 我有以下代码:
[self.tableView setBackgroundColor:[UIColor colorWithRed:0 green:185/255.0f blue:1 alpha:1];
I ended up with this: 我结束了这个:
The navigation bar did change color as it is supposed to, but the rest of the table view is still plain grey. 导航栏确实按预期的方式更改了颜色,但是表格视图的其余部分仍然是纯灰色。 How do you fix this?
您如何解决这个问题?
EDIT: I scroll my way to the bottom of the table view and it is fine. 编辑:我滚动到表格视图的底部,这很好。 The search bar on the top comes from a search controller, maybe that is the problem.
顶部的搜索栏来自搜索控制器,也许就是问题所在。 Here are a picture of the bottom:
这是底部的图片:
You can try to change the backgroundview of the tableview: 您可以尝试更改tableview的backgroundview:
UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.bounds.size.width, self.tableView.bounds.size.height)];
[backgroundView setBackgroundColor:[UIColor redColor]];
[self.tableView setBackgroundView:backgroundView];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.