Dynamic cell height for tableview

I am working on UITableView and the cells have different contents like a Facebook cell, so how can i change the height of each cell accordingly?


ANSWERS:


You Should follow the link This is best way to achieve to do this


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{

UIFont *font = [UIFont systemFontOfSize:20];
NSDictionary *userAttributes = @{NSFontAttributeName: font,
                             NSForegroundColorAttributeName:         [UIColor blackColor]};
NSString *text = @"Your label text";

CGSize textSize = [text sizeWithAttributes: userAttributes];

ht = 20;

if (textSize.width > [FunctionUtils getViewWidth]) {

ht = (textSize.width/([FunctionUtils getViewWidth]));
ht = (ceil(ht))*20+35;
//20 font size
}

return ht;
}


 MORE:


 ? UITableViewCell of different heights
 ? UITableViewCell, UITextView with dynamic height
 ? UITableViewCell becomes unresponsive
 ? Calculate dynamic height of uitableviewcell
 ? UITableViewCell dynamic height programmatically
 ? Dynamic UITableCellView height
 ? Dynamic UITableCellView height
 ? Dynamic UITableCellView height
 ? Dynamic UITableCellView height
 ? Dynamic UITableCellView height with cell indicator