为什么我不能将 tableview 背景颜色设置为白色?

Why can't I set tableview background color to white?

每当我这样做时,运行 应用程序都是浅灰色的。我已经改变了我能改变的每一种颜色,但白色不会保持白色。我试过的所有其他颜色都可以,只是不是白色。

我试过这两个

self.tableView.backgroundView = UIView()
self.tableView.backgroundView!.backgroundColor = .white



self.tableView.backgroundColor = .white

我试过在情节提要中将它设置为白色

您应该使用正确的矩形创建视图:

    self.tableView.backgroundView = UIView(frame: self.tableView.frame)