Upvote:2

Aprove answer
_tableView.estimatedRowHeight = 44.0; // set to whatever your "average" cell height is
_tableView.rowHeight = UITableViewAutomaticDimension;

Upvote:2

    tableCountries.estimatedRowHeight = 100.0;
    tableCountries.rowHeight = UITableViewAutomaticDimension;

More Answer related to the Same Query

Upvote:1

let width = 100.0 \\your text label's width you gave 
var height = chatMsg.text?.height(withConstrainedWidth: width, font: chatMsg.font!)

Upvote:1

-(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}

Credit Goes to: stackoverflow.com

Related question with same questions but different answers