我想为我的tableview设置背景 View ,
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let backgroundView = BackgroundGradient(frame: self.view.frame)
self.tableView.backgroundView = backgroundView
}
但是背景仍然是白色(应该是蓝色渐变)。我试图在 View 中设置它并加载,结果相同,我更改为背景颜色以清除,但仍然没有。我错过了什么?
最佳答案
您的 UITableViewCell
可能会遮挡您表格的 backgroundView
。尝试将单元格的背景颜色设置为清除。
引自 Apple 文档 (https://developer.apple.com/reference/uikit/uitableview/1614986-backgroundview)
You must set this property to nil to set the background color of the table view.
关于ios - 设置uitableview背景 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44216329/