Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 如何访问tableView:HeightForRowatineXpath:中的cell.textLabel.text:from tableView:CellForRowatineXpath:_Objective C_Cocoa Touch_Uitableview - Fatal编程技术网

Objective c 如何访问tableView:HeightForRowatineXpath:中的cell.textLabel.text:from tableView:CellForRowatineXpath:

Objective c 如何访问tableView:HeightForRowatineXpath:中的cell.textLabel.text:from tableView:CellForRowatineXpath:,objective-c,cocoa-touch,uitableview,Objective C,Cocoa Touch,Uitableview,在tableView:HeightForRowatineXpath:method中,我需要获取tableView:CellForRowatineXpath中cell.textLabel.text的长度。如何做到这一点?调用CellForRowatineXpath涉及到调用HeightForRowatineXpath,因此如果从HeightForRowatineXpath调用它,那么最终将进入无限递归 您可以使用数据源检查用于填充cellForRowAtIndexPath中单元格的相同数据,然后使

在tableView:HeightForRowatineXpath:method中,我需要获取tableView:CellForRowatineXpath中cell.textLabel.text的长度。如何做到这一点?

调用CellForRowatineXpath涉及到调用HeightForRowatineXpath,因此如果从HeightForRowatineXpath调用它,那么最终将进入无限递归


您可以使用数据源检查用于填充cellForRowAtIndexPath中单元格的相同数据,然后使用获取要插入cell.textLabel.text的文本的长度(或用于计算标签的大小)。

但是当行的高度取决于单元中的“可用”空间(即:单元的宽度、较小的边距、较小的附件视图、设备的方向等)是的,好的,边距是相当静态的,但是(大约)其他一切都取决于单元本身的配置,这在heightForRow中对您来说是不可用的,正如您注意到的无限递归问题。我正在积极寻求解决方案,正如我们所说的。。。