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
This is how I worked out.
1) Set no. of lines to 0.
2) Set LineBreakage.
3) Add Constraints.
4) Change vertical content hugging priority.
5) On ViewDidLoad:
override func viewDidLoad() {
super.viewDidLoad()
self.sampleTableView.estimatedRowHeight = 600.0;
self.sampleTableView.rowHeight = UITableViewAutomaticDimension;
self.sampleTableView.setNeedsLayout()
self.sampleTableView.layoutIfNeeded()
}
6) On TableView Custom Cell:
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
sizeToFit()
layoutIfNeeded()
}