我有一个需要填充的 UITableView header 。我正在使用 ViewForHeaderInSection
数据源数组是在我选择页 footer 分的单元格后创建的(我选择我想要“固定到顶部”的最喜欢的单元格。
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]
或者您可以在favoriteCell中添加sectionTitles变量
headerCell?.name.text = favoritecells.sectionTitles[section]
关于ios - 如何在 UITableView 中填充标题单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48073085/