UITableview dynamic problem height

I have installed

self.tableView.estimatedRowHeight = 88.0 self.tableView.rowHeight = UITableViewAutomaticDimension 

I also made numOfLines UILabel equal to zero. I did not set a fixed height / width limit in IB. However, my UITableviewCell height does not expand accordingly.

Please suggest me what to do.

+6
source share
3 answers

Check if you explicitly define the tableView method: heightForRowAtIndexPath. If this removes this method, or if you want to use it due to the presence of multiple cells, you can return a UITableViewAutomaticDimension for that specific cell height.

+6
source

Try the following:

 func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } 

EDIT

 func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return UITableViewAutomaticDimension } 

Define both methods above. Solve the problem.

+8
source

You must verify that the first view from above has a restriction on the top of the cell and the bottom on the bottom of the cell. Thus, the cell will know how large its content is. And check your journal for conflict conflicts. You can use this for reference: https://www.raywenderlich.com/87975/dynamic-table-view-cell-height-ios-8-swift

+1
source

All Articles