回答編集履歴
2
テスト中の不要コード削除&修正。
test
CHANGED
@@ -52,17 +52,13 @@
|
|
52
52
|
|
53
53
|
cell.contentView.alpha = 1
|
54
54
|
|
55
|
-
cell.contentView.backgroundColor = nil
|
56
|
-
|
57
55
|
} else {
|
58
56
|
|
59
57
|
//disable
|
60
58
|
|
61
|
-
cell.backgroundColor = .
|
59
|
+
cell.backgroundColor = .darkGray
|
62
60
|
|
63
61
|
cell.contentView.alpha = 0.5
|
64
|
-
|
65
|
-
cell.contentView.backgroundColor = .lightGray
|
66
62
|
|
67
63
|
}
|
68
64
|
|
1
それっぽいの。
test
CHANGED
@@ -1 +1,77 @@
|
|
1
1
|
黒い半透明のUIViewをセル(contentView)の上に乗せてon/offすればいいと思います。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
簡単にそれっぽく出来る方法を思い付いたので書いておきます。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
やっていることは、
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
* セルの背景をグレーにする。
|
18
|
+
|
19
|
+
* contentViewを半透明にする。(上に乗っているViewも半透明になる)
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
です。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
色やアルファを変えることで、ある程度はカスタマイズできると思います。
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
```swift
|
32
|
+
|
33
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
//enable/disableフラグ(仮)
|
42
|
+
|
43
|
+
let enable = !(indexPath.row % 3 == 0)
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
if enable {
|
48
|
+
|
49
|
+
//enable
|
50
|
+
|
51
|
+
cell.backgroundColor = nil
|
52
|
+
|
53
|
+
cell.contentView.alpha = 1
|
54
|
+
|
55
|
+
cell.contentView.backgroundColor = nil
|
56
|
+
|
57
|
+
} else {
|
58
|
+
|
59
|
+
//disable
|
60
|
+
|
61
|
+
cell.backgroundColor = .black
|
62
|
+
|
63
|
+
cell.contentView.alpha = 0.5
|
64
|
+
|
65
|
+
cell.contentView.backgroundColor = .lightGray
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
return cell
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
|