为什么Apple有heightForRowForIndexPath?

Sha*_*yrs -2 objective-c uitableview ios

我的意思是,这看起来像是一种矫枉过正.它已经有了cellForRowForIndexPath

一旦UITableViewSourceDelegate获得了单元格,它就可以通过计算单元格的高度轻松获得高度.

所以为什么?

Gab*_*lla 8

heightForRowAtIndexPath 为表中的每一行调用,以计算其总高度,从而设置滚动指示符的正确大小.

另一方面cellForRowForIndexPath,仅针对可见细胞进行调用.