I have a tableview (A) each user cell having a tableview (B) with a table dynamic view cell.
In tableview (A) cellForRowAtIndex.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MainMessageTVCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MsgMainCell"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
NSInteger index = indexPath.row;
MessageMain *result = tableData[index];
cell.dateLabelTC.text = [NSString stringWithFormat:@"Date : %@",result.createdTime];
cell.subjectLabelTC.text = [NSString stringWithFormat:@"Subject : %@",result.subject];
NSArray *arrList = result.messageList;
[cell setupTableData:(NSMutableArray *)arrList];
[cell setNeedsUpdateConstraints];
}
In tableview (A), the user reloads the table table (B).
-(void)setupTableData:(NSMutableArray *)tableData{
_tableData = tableData;
[self.tableView reloadData];
}
-(void)updateConstraints{
[super updateConstraints];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView layoutIfNeeded];
CGFloat height = self.tableView.contentSize.height;
tableBHeightConstraints.constant = height;
});
}
tableBHeightConstraints are the table view height limits (B) in a child of tableview (A). tableBHeightConstraints.constant does not get the correct value with all calculations.
Which place is better or better to get tableView.contentSize.height exactly after setting the dynamic height of the table cell.
This is a tableview element (A)


This is the table (B) Cell
Please help the guys.