Get height of UITableView without scroll bars

前端 未结 4 1573
野趣味
野趣味 2021-01-31 02:25

I need to get the full height of a UITableView (i.e. the height at which there would be nothing more to scroll). Is there any way to do this?

I\'ve tried

4条回答
  •  [愿得一人]
    2021-01-31 03:07

    Obligatory Swift 3.0 & 2.2 answer.

    var tableViewHeight: CGFloat {
        tableView.layoutIfNeeded()
    
        return tableView.contentSize.height
    }
    

提交回复
热议问题