Change Height of a UITableViewCell

后端 未结 5 1446
一整个雨季
一整个雨季 2021-02-13 04:36

I want to make a UITableViewCell bigger. How can I do this, I have tried adjusting its frame but nothing happens. What can I do?

5条回答
  •  死守一世寂寞
    2021-02-13 05:05

    I found this answer to be the most informative and most up-to-date to change the height of a table view cell.

    TL;DR

    1. Take extra care when making your Auto Layout constraints
    2. Enable row height estimation on your table view in the viewDidLayoutSubviews method.

      self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.estimatedRowHeight = 44.0; // set to whatever your "average" cell height is

提交回复
热议问题