我有一个我使用的标题数组
let sectionHeaderTitleArray = ["test1","test2","test3]
他们使用
func tableView[tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return self.sectionHeaderTitleArray[section] as String
}
现在所有这些都很好,但我想修改标题的背景色,使它们更可见( colored颜色 更深)
你知道我可以用简单的一行来做这件事,还是需要使用自定义单元格来创建它
谢谢
使现代化
//number of sections and names for the table
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return self.sectionHeaderTitleArray.count
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return self.sectionHeaderTitleArray[section] as String
}
func tableView(tableView: UITableView, ViewForHeaderInSection section: Int) -> UIView? {
return self.tableView.backgroundColor = UIColor.lightGrayColor()
}