Avinash kumawat
Avinash kumawat

Reputation: 75

adjust UITableViewCell height according to the content

content of the cell is hiding. I tried to increase the height of cell but its not working.

When I am running the app

In my storyboard

I tried:

 self.tableView.estimatedRowHeight = 80
 self.tableView.rowHeight = UITableViewAutomaticDimension

and also tried

self.tableView.setNeedsLayout()

self.tableView.layoutIfNeeded()

Please help me to figure out what's wrong

Upvotes: 1

Views: 149

Answers (1)

alexburtnik
alexburtnik

Reputation: 7741

Check your vertical constraints for labels. You need to set fixed spacing between the following:

  1. Top & Label1
  2. Label1 & Label2
  3. Label2 & Label3
  4. Label3 & Bottom

This way all three labels will have dynamic height and cell will have appropriate height as well.

Upvotes: 1

Related Questions