質問編集履歴
2
諸々
test
CHANGED
File without changes
|
test
CHANGED
@@ -144,29 +144,23 @@
|
|
144
144
|
|
145
145
|
※追記
|
146
146
|
|
147
|
-
上に載せていたViewを削除して、ContentViewに対して
|
148
|
-
|
149
147
|
```Swift
|
150
148
|
|
151
|
-
func
|
149
|
+
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
152
150
|
|
153
|
-
|
151
|
+
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
|
154
152
|
|
155
|
-
|
153
|
+
let viewController = UIViewController()
|
156
154
|
|
157
|
-
|
155
|
+
viewController.view.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
|
158
156
|
|
159
|
-
|
160
|
-
|
161
|
-
//
|
157
|
+
// viewController.view.backgroundColor = dataSource[indexPath.row]
|
162
158
|
|
163
159
|
cell.contentView.backgroundColor = dataSource[indexPath.row]
|
164
160
|
|
165
|
-
|
161
|
+
cell.addSubview(viewController.view)
|
166
162
|
|
167
163
|
return cell
|
168
|
-
|
169
|
-
|
170
164
|
|
171
165
|
}
|
172
166
|
|
1
諸々
test
CHANGED
File without changes
|
test
CHANGED
@@ -135,3 +135,41 @@
|
|
135
135
|
|
136
136
|
|
137
137
|

|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
※追記
|
146
|
+
|
147
|
+
上に載せていたViewを削除して、ContentViewに対して
|
148
|
+
|
149
|
+
```Swift
|
150
|
+
|
151
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
//gurad文でカスタムセルを読み込み、無理ならUITableViewCell()を返す
|
156
|
+
|
157
|
+
guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell else { return UITableViewCell() }
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
// cell.backgroundColor = dataSource[indexPath.row]
|
162
|
+
|
163
|
+
cell.contentView.backgroundColor = dataSource[indexPath.row]
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
return cell
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
と書きましたが、変わりませんでした。
|