I want to dynamically increase the height of tableview cell according to Content of textview in cell. Here I create textview and add that textview in cell as subview. So according to content of textview height of tableview cell is get fixed. Any one know how to do that.
Thanks in advance
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
int rowHeight =0.0f;
NSString *temp = @"bqDHJIGQ BQWFVHWEF Q dsbkn w jwh ndbvdhqd bdhjqdv dqvhdqvb dbqvwvhdqwwd bqwdhjvqwdhjvqwd bqdwjhqwdvbqwd q dbdqwqbvqwdvdw qwdhqwdvbqw dbqvwdjqwd dwbvvqjwd nqdjqvdjqw dwnqwdjvqhdq nwwdjqwvdhjqwd qwdhjvhvbjd n qhjdvqdw dbqw wbdww.";
CGSize size = [temp sizeWithFont:[UIFont systemFontOfSize:13.0f] constrainedToSize:CGSizeMake(300, 5000) lineBreakMode:UILineBreakModeWordWrap];// calculate the height
rowHeight = size.height+10; // i use 10.0f pixel extra because depend on font
return rowHeight;
}