回答編集履歴
2
Color
answer
CHANGED
@@ -14,6 +14,6 @@
|
|
14
14
|
|
15
15
|
```swift
|
16
16
|
if let cell = collectionView.cellForItem(at: indexPath) {
|
17
|
-
cell.contentView.
|
17
|
+
cell.contentView.backgroundColor = .red
|
18
18
|
}
|
19
19
|
```
|
1
cellForItem(at:)
answer
CHANGED
@@ -6,4 +6,14 @@
|
|
6
6
|
|
7
7
|
で色は変わると思います。
|
8
8
|
|
9
|
-
あとは、「セルの再利用」について調べて下さい。
|
9
|
+
あとは、「セルの再利用」について調べて下さい。
|
10
|
+
|
11
|
+
# セルの取得
|
12
|
+
|
13
|
+
セルの取得方法が間違っています。
|
14
|
+
|
15
|
+
```swift
|
16
|
+
if let cell = collectionView.cellForItem(at: indexPath) {
|
17
|
+
cell.contentView.background = .red
|
18
|
+
}
|
19
|
+
```
|