如何自定义 UITableView 的页眉背景颜色、高度和文本



我想为 UITableView 自定义我的节标题。如何添加文本颜色、背景颜色和节标题高度?

func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int){
    view.tintColor = UIColor.black
    let header = view as! UITableViewHeaderFooterView
    header.textLabel?.textColor = UIColor.white
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 50.0
}

最新更新