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

标签 ios swift uitableview header

我有一个需要填充的 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/

相关文章:

ios - 在 iOS Cocos2D 中使用加速滚动背景

ios - 使用 Swift AVPlayer 显示视频轨道的时间码

ios - 渐变不显示快速 Xcode

ios - CoreData 重复结果,时间戳谓词

ios - 在导航栏项目之间创建空白区域?

ios - 动画 CIFilter CIPerspectiveCorrection

json - 如何在 Swift 4 的可解码协议(protocol)中使用自定义键?

iphone - 检查 UIButton 是否已经存在于 UITableViewCell 上

ios - 在 ios 中的单元格内截取 View

objective-c - viewDidLayoutSubviews 相当于 UITableViewCell