forkingdog / forkingdog/UITableView-FDTemplateLayoutCell

关于iOS8,tableView:heightForRowAtIndexPath:方法调用次数有疑问。

Open
#111 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Objective-C
Stars
9.9k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

```
Since iOS8, -tableView:heightForRowAtIndexPath: will be called more times than we expect, we can feel these extra calculations when scrolling. So we provide another API with cache by index path:,

这是你在cell高度缓存里面所说的,意思就是说在iOS8开始tableView:heightForRowAtIndexPath调用次数会增加,我用我的调试方法是由两种情况的:

首先,在程序启动后,tableview界面上显示了两个cell。调试方法:调试方式,在第一次调用cellForRowAtIndexPath:打断点后再在tableView:heightForRowAtIndexPath:里面打断点。

结果:1,当使用了估计高度方法后,tableView:heightForRowAtIndexPath:方调了4次 2,当不使用估计高度方法后,当已经返回所有高度(已经调用跟cell数量一样次数的tableView:heightForRowAtIndexPath:方法后),还会调用2次tableView:heightForRowAtIndexPath:。

所以你这里是不是也是也调用了tableView:estimatedHeightForRowAtIndexPath:这个方法后的说法?
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.