how can i set different height for different rows of custom ui table view cell in ios? I am trying to change the height depending upon the how much lines there are in my uitextview which is inside my custom uitableview cell.
I tried setting height like this inside my heightForRowAtIndexPath method but it crashes:
PostStreamCell *cell = [tableView cellForRowAtIndexPath:indexPath];
int lines = cell.txtViewMessage.contentSize.height / cell.txtViewMessage.font.lineHeight;
if(lines < 4)
{
return 100;
}
else if(lines == 4)
{
return 100;
}
else{
return 220;
}