UITableView - change section header color

前端 未结 30 2899
不思量自难忘°
不思量自难忘° 2020-11-27 08:50

How can I change color of a section header in UITableView?

EDIT: The answer provided by DJ-S should be considered for iOS 6 and above. The accepted

30条回答
  •  猫巷女王i
    2020-11-27 09:22

    iOS 8+

    func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
            tableView.tableHeaderView?.backgroundColor = UIColor.blue()
    }
    

提交回复
热议问题