UITableView自定义头部改变背景色

664 阅读1分钟

[TableView] Changing the background color of UITableViewHeaderFooterView is not supported. Use the background view configuration instead.

let backgroundView = UIView(frame: headerView.bounds)
backgroundView.backgroundColor = UIColor.purple
headerView.backgroundView = backgroundView

Simulator Screen Shot - iPhone 11 - 2021-10-11 at 20.51.33.png