質問編集履歴

1

高さを条件分岐してみましたが、cellForRowAtで判明している数値を再計算しており、非効率な方法な気がしています。。

2018/11/17 08:29

投稿

HNSZ
HNSZ

スコア33

test CHANGED
File without changes
test CHANGED
@@ -163,3 +163,39 @@
163
163
  }
164
164
 
165
165
  ```
166
+
167
+
168
+
169
+ ### <追記>高さを条件分岐
170
+
171
+ ```
172
+
173
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
174
+
175
+
176
+
177
+ if onlyPaid == false{
178
+
179
+ return displayHeight / 9
180
+
181
+
182
+
183
+ } else {
184
+
185
+ let dict = items[(indexPath as NSIndexPath).row]
186
+
187
+ if dict["PointPaid"] as? Int == nil{
188
+
189
+ return 0.01
190
+
191
+ } else{
192
+
193
+ return displayHeight / 9
194
+
195
+ }
196
+
197
+ }
198
+
199
+ }
200
+
201
+ ```