How to add a footer to the UITableView?

前端 未结 11 1963
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 04:23

I\'me using this code to add a footer to the TableView. It has 20 sections, and each section a few rows. There\'s a titleForHeaderInSection, and sectionForSectionIndexTitle

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 04:45

    Swift 2.1.1 below works:

    func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
            let v = UIView()
            v.backgroundColor = UIColor.RGB(53, 60, 62)
            return v
        }
    
        func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
            return 80
        }
    

    If use self.theTable.tableFooterView = tableFooter there is a space between last row and tableFooterView.

提交回复
热议问题