UITableViewHeaderFooterView: Unable to change background color

前端 未结 20 2306
误落风尘
误落风尘 2020-12-23 08:38

I\'m trying to change the background color of UITableViewHeaderFooterView. Although the view is appearing, the background color remains the default color. I\'m getting a log

20条回答
  •  被撕碎了的回忆
    2020-12-23 09:21

    Swift:

    func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView {
        var headerView: TableViewHeader = super.tableView(tableView, viewForHeaderInSection: section) as! TableViewHeader
        headerView.backgroundView.backgroundColor = UIColor.redColor()
    }
    

提交回复
热议问题