I have an application in which I have a Tableview , and each row is scanned in this table. I am dynamically creating my own tableview cell.
Below is the code for this.
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"flowviewTableViewCell" owner:self options:nil];
cell2 = [nib objectAtIndex:0];
return cell2;
"FlowTableViewCell" is a UITableViewCell. In this user cell, I have one table view.
I show some data in my own tableview cell from an array, and this data varies in length. It is not fixed.
I can increase the size of the user cell, but not the main row height of the table, depending on the size of the user cell in the table.
I want to increase the height of the main table cell size dynamically depending on the size of the user table cell.
In the following code, the height of the custom tableView cell is increased.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *str = [arrComments objectAtIndex:indexPath.row];
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Helvetica" size:14] constrainedToSize:CGSizeMake(280, 999) lineBreakMode:NSLineBreakByWordWrapping];
NSLog(@"%f",size.height);
if (size.height<20)
{
size.height=20;
}
NSLog(@"%f",size.height);
return size.height + 30;
}
How to adjust the height of the main height of the table table depending on the size of the user table tableviewcell?
Here I am attaching some screenshots for a clear understanding.
Below is my custom TableViewCell:

Below is my main TableView:

The following is the output that I am getting right now:

In the above image, you can see that comment2 gets cut, and comment3 of the same message is displayed in the next message.
I need the output as shown below.

So my question is how to dynamically increase the height of the main table cell size depending on the size of the user table cell?
, .