如何隐藏表格视图节标题下的单元格?

时间:2019-04-08 11:09:41

标签: ios swift uitableview uitableviewsectionheader

我有一个普通的表视图,该表视图节标题的背景颜色很清晰,滚动时是否有任何方法可以隐藏该节下面的单元格? 请参见下图:

enter image description here

这是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
}

有什么建议吗?

0 个答案:

没有答案