tableview 셀은 매우 복잡합니다. 내용 때문에 동적으로 변경할 수있는 레이블이 하나 있습니다.왜 tableviewcell의 systemLayoutSizeFittingSize가 0 일 때 결과가 항상 0입니까?
MyTaskTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
[self configureCell:cell forIndexPath:indexPath withCellIndentifier:cellIdentifier];
[cell setNeedsUpdateConstraints];
[cell updateConstraintsIfNeeded];
NSLog(@"%f",[cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height);
화면에 표시되는 내용이 정확합니다. 콘텐츠의 끝선과 셀의 아래쪽 사이에 빈 줄이 있습니다. 하지만 높이가 항상 0으로 출력됩니다. 동적으로 셀 높이를 설정할 수 없습니다. 어떻게됩니까? 당신이이 기능에 뭔가를해야 동적 높이를 갖고 싶어
반드시 높이를 계산할 필요는 없지만 자동 레이아웃이 처리해줍니다. – gabbler