How can I make the footerview always stay at the bottom in UITableViewController?

前端 未结 4 1979
日久生厌
日久生厌 2021-02-13 20:56

I am using a UITableviewcontroller and I want the footer view to always stay at the bottom of the screen. However, the y

4条回答
  •  鱼传尺愫
    2021-02-13 21:31

    Swift Code which make the footerView fill the rest space at the bottom, then you can use autolayout to make you view at the bottom in the footerView:

    override func viewDidLayoutSubviews()
    {
        super.viewDidLayoutSubviews()
    
    
        guard let footerView = tableView.tableFooterView else
        {
            return
        }
    
        var cellsHeight:CGFloat = tableView.tableHeaderView?.frame.height ?? 0
    
        let sections = self.numberOfSections(in: tableView)
        for section in 0..

提交回复
热议问题