UITableView tableFooterView shows at the top of the UITableView - wrong

前端 未结 7 2314
北海茫月
北海茫月 2021-02-08 15:37

I have created a very simple test case to reproduce this issue.

I am trying to set a footer view programmatically to a tableview. Please note that I am referring to the

相关标签:
7条回答
  • 2021-02-08 16:22

    First set tableView.tableFooterView = customView

    Then, call updateTableFooterViewSize() function in viewDidLayoutSubviews or layoutSubviews

    private func updateTableFooterViewSize() {
        let width: CGFloat = view.frame.width // required width
        let height: CGFloat = 50 // required height 
        tableView.tableFooterView?.frame.size = CGSize(width: width, height: height)
    }
    
    0 讨论(0)
提交回复
热议问题