gpt4 book ai didi

ios - 根据单元格内tableview高度的高度计算tableview单元格的高度?

转载 作者:行者123 更新时间:2023-11-28 08:10:40 36 4
gpt4 key购买 nike

我有一个表格 View 。我有一个自定义单元格。在那个自定义单元格中,我有一个 UITableView。这个子表格 View 可以有单元格,它们的内容高度可以是动态的。所以我想要计算每个单元格的高度并乘以单元格的数量。在计算出的高度之后为主单元格提供高度。

我将使用下面的逻辑

**Total height of main cell = height of each cell in child tableview * no of cells + header** 

但我不知道该怎么做。请指导我该怎么做

最佳答案

试试这个

[tableView reloadData] ; 
CGSize tableViewSize= tableView.contentSize; // here you get your tablview's total height

获取 tableView 的父单元格

   UITableViewCell *parentCellcell =(UITableViewCell *)tableView.superview.superview; // track your cell
if (parentCellcell){
NSIndexPath *indexPath = [tblViewParent indexPathForCell:cell];
[tblViewParent reloadRowsAtIndexPaths:[NSArray
arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
}

关于ios - 根据单元格内tableview高度的高度计算tableview单元格的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43864811/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com