質問編集履歴

1

追加

2018/08/03 12:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -29,3 +29,37 @@
29
29
  一つのセクションで二つのカスタムセルを使いたく、イメージとしては上記のようなことを実装したいのですが、やり方がわかりません。
30
30
 
31
31
  どなたかアドバイスいただけないでしょうか?
32
+
33
+ 以下のコードでは'Attempted to dequeue multiple cells for the same index path, which is not allowed. If you really need to dequeue more cells than the table view is requestingと言われてしまいました。
34
+
35
+
36
+
37
+ ```
38
+
39
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
40
+
41
+ let article = articles[indexPath.row]
42
+
43
+ let cell = tableView.dequeueReusableCell(withIdentifier: "ArticleTableViewCell", for:indexPath) as! ArticleTableViewCell
44
+
45
+ if finishedLoading {
46
+
47
+ if indexPath.row == 0 {
48
+
49
+ let cellTop = tableView.dequeueReusableCell(withIdentifier: "ArticleTopTableViewCell", for:indexPath) as! ArticleTopTableViewCell
50
+
51
+ cellTop.configure(article: article)
52
+
53
+ return cellTop
54
+
55
+ }
56
+
57
+ cell.configure(article: article)
58
+
59
+ }
60
+
61
+ return cell
62
+
63
+ }
64
+
65
+ ```