You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-2Lines changed: 33 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,9 @@ If you have a **self-satisfied** cell, then all you have to do is:
22
22
}];
23
23
}
24
24
```
25
-
## Advanced usage with height caching
25
+
## Height Caching API
26
26
27
-
Since iOS8, `-tableView:heightForRowAtIndexPath:` will be called more times than we expect, we can feel these extra calculations when scrolling. So we provide another extension with caches:
27
+
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 caches:
@@ -35,8 +35,39 @@ Since iOS8, `-tableView:heightForRowAtIndexPath:` will be called more times than
35
35
}
36
36
```
37
37
38
+
### Auto cache invalidation
39
+
38
40
Extra calculations will be saved if a height at an index path has been cached, besides, **NO NEED** to worry about invalidating cached heights when data source changes, it will be done **automatically** when you call "-reloadData" or any method that triggers UITableView's reloading.
39
41
42
+
## Precache
43
+
44
+
Pre-cache is an advanced function which helps to cache the rest of offscreen UITableViewCells automatically, just in **"idle"** time. It helps to improve scroll performance, because no extra height calculating will be used when scrolls. It's enabled by default if you use "fd_heightForCellWithIdentifier:cacheByIndexPath:configuation:" API.
45
+
46
+
## Debug log
47
+
48
+
Debug log helps to debug or inspect what is this "FDTemplateLayoutCell" extention doing, turning on to print logs when "calculating", "precaching" or "hitting cache".Default to "NO", log by "NSLog".
49
+
50
+
```
51
+
tableView.fd_debugLogEnabled = YES;
52
+
```
53
+
54
+
It will print like this:
55
+
56
+
```
57
+
** FDTemplateLayoutCell ** layout cell created - FDFeedCell
** FDTemplateLayoutCell ** hit cache - [0:4] 278.5
67
+
** FDTemplateLayoutCell ** hit cache - [0:5] 156
68
+
** FDTemplateLayoutCell ** hit cache - [0:6] 165
69
+
```
70
+
40
71
## About self-satisfied cell
41
72
42
73
a fully **self-satisfied** cell is constrainted by auto layout and each edge("top", "left", "bottom", "right") has at least one layout constraint against it.
0 commit comments