UITableView 中部分标题的颜色

问题描述

我正在创建一个表格,我希望所有部分的标题为黑色,部分的页脚为绿色。 页眉/页脚是使用 UITableViewheaderfooterView

创建的
let sectionFooterView: UITableViewheaderfooterView = {
        UITableViewheaderfooterView()
    }()

设置背景颜色的代码

func tableView(_: UITableView,viewForHeaderInSection _: Int) -> UIView? {
    let view = mainView.sectionHeaderView
    view.tintColor = .black
    return view
}

func tableView(_: UITableView,heightForHeaderInSection _: Int) -> CGFloat {
    UITableView.automaticDimension
}

func tableView(_: UITableView,viewForFooterInSection _: Int) -> UIView? {
    let view = mainView.sectionFooterView
    view.tintColor = .green
    return view
}

func tableView(_: UITableView,heightForFooterInSection _: Int) -> CGFloat {
    UITableView.automaticDimension
}

我只对表格中间某处的页眉/页脚进行了着色,但大多数页眉/页脚仍然是清晰的颜色。有什么要改变的?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)