質問編集履歴
1
動いたのでコードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -59,3 +59,57 @@
|
|
59
59
|
・ CellはカスタムCellを使っています
|
60
60
|
|
61
61
|
・ 画像はSDWebImageでキャッシュしています
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
###解決?
|
66
|
+
|
67
|
+
```swift
|
68
|
+
|
69
|
+
var imagePageCount:Dictionary<Int, CGFloat> = [:]
|
70
|
+
|
71
|
+
var imageScrollView:Dictionary<Int, CGRect> = [:]
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
internal func tableView(_ tableView: UITableView, cellForRowAt indexPath:IndexPath) -> UITableViewCell {
|
76
|
+
|
77
|
+
print("セルを作った")
|
78
|
+
|
79
|
+
let cell: TimelineCell = tableView.dequeueReusableCell(withIdentifier: "TimelineCell", for: indexPath as IndexPath) as! TimelineCell
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
cell.setCell(timeline: timelineData[indexPath.row])
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
if (imageScrollViewData[indexPath.row] != nil) {
|
88
|
+
|
89
|
+
cell.imageScrollView.contentOffset.x = imagePageCount[indexPath.row]!
|
90
|
+
|
91
|
+
cell.imageScrollView.frame = imageScrollView:Dictionary[indexPath.row]!
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
return cell
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
104
|
+
|
105
|
+
print("画面外にでた")
|
106
|
+
|
107
|
+
let cell: TimelineCell = tableView.dequeueReusableCell(withIdentifier: "TimelineCell", for: indexPath as IndexPath) as! TimelineCell
|
108
|
+
|
109
|
+
imagePageCount[indexPath.row] = cell.imageScrollView.contentOffset.x
|
110
|
+
|
111
|
+
imageScrollView:Dictionary[indexPath.row] = cell.imageScrollView.frame
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
```
|