ダイナミックテーブルビューセルを持つテーブルビュー(B)を持つすべてのカスタムセルがあります。ダイナミックセルのテーブルビューを設定するテーブルビューの高さの制約にコンテンツの高さを設定するios
at 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];
}
テーブルビュー(A)のカスタムセルリロードテーブルビュー(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;//+1000;
tableBHeightConstraints.constant = height;
});
}
tableBHeightConstraintsテーブルビューでテーブルビュー(B)の高さの制約(A)のセルの子です。 tableBHeightConstraints.constantはすべての計算制約で正しい値を取得しません。
ダイナミックテーブルセルの高さを設定した後、tableView.contentSize.heightを正確に取得するのに最適な場所または方法は何ですか?
これは、テーブルビュー(B)でのセル
人を助けてください。
私は動的なセルを持っており、ヘッダーとフッターも持っているので、テーブルの内容の高さをどのように取得するか。 –