I have a UITableView in which i am displaying a custom cell.I my cell i have two label & one view as below in picture.
I have given constraint of left v
Swift 4.2
For the Basic
or Subtitle
type of cell, first in viewDidLoad
you do this:
self.tableView.estimatedRowHeight = 44 // This is the default cell height
self.tableView.rowHeight = UITableView.automaticDimension
Then select the Title and set its number of lines to 0. Now the row will adjust its height based on the Title text. You don't need to do anything else.
Same goes for your Custom cell types. Make sure the Label which you use in your custom cell is set for 0 lines as well.