如何在UITableView中填充标题单元格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在UITableView中填充标题单元格相关的知识,希望对你有一定的参考价值。

我有一个UITableView标头,我需要填充。我正在使用ViewForHeaderInSection数据源阵列是由我选择它们之后由Footer Section的单元格创建的(我选择了我想要“引脚到顶部”的最喜欢的单元格。

   override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    let headerCell = tableView.dequeueReusableCell(withIdentifier: "HeaderViewCell") as? HeaderTableViewCell
    headerCell?.name.text = favoritecells //how can I select the source?
    return headerCell
}

我该如何填写此功能?

答案

你有一系列的部分标题

let headerTitle = sectionTitles[section]

或者您可以在favouriteCell中添加sectionTitles变量

headerCell?.name.text = favoritecells.sectionTitles[section]

以上是关于如何在UITableView中填充标题单元格的主要内容,如果未能解决你的问题,请参考以下文章

在 UITableView 单元格中的图像上填充

在uitableview中带有空格填充的圆形单元格

如何从获取的结果对象中填充稀疏的 UITableView?

如何在 UITableView 中配置特定单元格?

如何操作 UITableView 以根据标题编辑单元格?

单元格数据未显示在 UITableView 中?