You should use UITableViewAutomaticDimension
provides a solution for displaying dynamic content.
Use below code in viewDidLoad
:
tableView.estimatedRowHeight = YourTableViewCellHeight
tableView.rowHeight = UITableView.automaticDimension
Read more from here
Hope it helps. :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…