1.设置高度为0 tv.sectionFooterHeight = 0 2 代理footview 返回 nil
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
return nil
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0
}
自定义footer
背景view 设置frame, subviews 使用约束布局
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { if section == 1 { let bgView = TGSUIModel.createView(bgColor: TGSUIModel.createColorHexInt(0xEEF0F3)) bgView.frame = CGRect(x: 0, y: 0, width: TGSScreenWidth, height: 30) let titleLable = TGSUIModel.creatLabe(text: "其他登录方式", font: TGSFontTool.getPingFangFont(14), textColor: TGSUIModel.createColorHexInt(0x666666), textAlignment: .left) bgView.addSubview(titleLable) titleLable.snp.makeConstraints { (make) in make.left.top.equalTo(15) } return bgView } return TGSUIModel.createView(bgColor: TGSUIModel.createColorHexInt(0xEEF0F3)) }