我有一个普通的表视图,该表视图节标题的背景颜色很清晰,滚动时是否有任何方法可以隐藏该节下面的单元格? 请参见下图:
这是viewForHeaderInSection
的实现:
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SYReminderHeaderCell")
let header = cell as! SYReminderHeaderCell
header.headerTitleLabel.textColor = .white
header.configureSectionItems()
guard let sectionInfo = fetchedResultsController.sections?[section] else {
return nil
}
header.contentView.backgroundColor = .clear
let title = SYDateUtils.prepareSectionTitleForTimeLineView(stringDate: sectionInfo.name)
header.setHeaderTitleAttribute(title: title)
let subTitle = SYDateUtils.prepareSectionSubTitleForTimeLineView(stringDate: sectionInfo.name)
header.setSubHeaderTitleAttribute(subTitle: subTitle)
header.separaterHeaderHeightConstraint.constant = 1/UIScreen.main.scale
header.separaterHeader.alpha = 0.0
header.layer.masksToBounds = true
return cell
}
有什么建议吗?