Get UITableView's height

前端 未结 5 1398
终归单人心
终归单人心 2021-02-20 10:27

I have created a UITableview with custom UITableViewCell.The UITableViewCell contains UILabels and I have calculated the heig

5条回答
  •  臣服心动
    2021-02-20 11:08

    Try this: tableView.backgroundView.bounds.size.height Should work

    Logic:

    • UITableView has a property, backgroundView which is "A table view’s background view is automatically resized to match the size of the table view."
    • backgroundView is a UIView which has the property bounds which is a CGRect that "defines the size and position of the view."
    • CGRect has a size property, size has a height property

    QED

提交回复
热议问题