如何在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中填充标题单元格的主要内容,如果未能解决你的问题,请参考以下文章