質問編集履歴
2
諸々
title
CHANGED
File without changes
|
body
CHANGED
@@ -71,18 +71,15 @@
|
|
71
71
|
|
72
72
|
|
73
73
|
※追記
|
74
|
-
上に載せていたViewを削除して、ContentViewに対して
|
75
74
|
```Swift
|
76
|
-
func
|
75
|
+
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
77
|
-
|
78
|
-
//gurad文でカスタムセルを読み込み、無理ならUITableViewCell()を返す
|
79
|
-
|
76
|
+
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
|
80
|
-
|
77
|
+
let viewController = UIViewController()
|
78
|
+
viewController.view.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
|
81
|
-
//
|
79
|
+
// viewController.view.backgroundColor = dataSource[indexPath.row]
|
82
80
|
cell.contentView.backgroundColor = dataSource[indexPath.row]
|
83
|
-
|
81
|
+
cell.addSubview(viewController.view)
|
84
82
|
return cell
|
85
|
-
|
86
83
|
}
|
87
84
|
```
|
88
85
|
と書きましたが、変わりませんでした。
|
1
諸々
title
CHANGED
File without changes
|
body
CHANGED
@@ -66,4 +66,23 @@
|
|
66
66
|
```
|
67
67
|

|
68
68
|
|
69
|
-

|
69
|
+

|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
※追記
|
74
|
+
上に載せていたViewを削除して、ContentViewに対して
|
75
|
+
```Swift
|
76
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
77
|
+
|
78
|
+
//gurad文でカスタムセルを読み込み、無理ならUITableViewCell()を返す
|
79
|
+
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell else { return UITableViewCell() }
|
80
|
+
|
81
|
+
// cell.backgroundColor = dataSource[indexPath.row]
|
82
|
+
cell.contentView.backgroundColor = dataSource[indexPath.row]
|
83
|
+
|
84
|
+
return cell
|
85
|
+
|
86
|
+
}
|
87
|
+
```
|
88
|
+
と書きましたが、変わりませんでした。
|