質問編集履歴
1
class、各コントローラーの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -9,3 +9,199 @@
|
|
9
9
|
なかなか調べても納得のいくものが見つからないためどうか皆様のご教授頂ければ幸いです。
|
10
10
|
|
11
11
|
![イメージ説明](fbd077339c9c85e5a23ab4b65abf42fe.png)
|
12
|
+
|
13
|
+
```class
|
14
|
+
|
15
|
+
class Typevalue {
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
var Analyzer = [0,0,0,0,0]
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
}
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
```viewController
|
28
|
+
|
29
|
+
class ViewController: UIViewController {
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
var typesCount = Typevalue()
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
override func viewDidLoad() {
|
40
|
+
|
41
|
+
super.viewDidLoad()
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
@IBAction func button(_ sender: Any) {
|
56
|
+
|
57
|
+
typesCount.Analyzer[0] = 1
|
58
|
+
|
59
|
+
print("1回目の処理")
|
60
|
+
|
61
|
+
print(typesCount.Analyzer)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
@IBAction func button2(_ sender: Any) {
|
70
|
+
|
71
|
+
typesCount.Analyzer[0] = 2
|
72
|
+
|
73
|
+
print("1回目の処理")
|
74
|
+
|
75
|
+
print(typesCount.Analyzer)
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
@IBAction func button3(_ sender: Any) {
|
84
|
+
|
85
|
+
typesCount.Analyzer[0] = 3
|
86
|
+
|
87
|
+
print("1回目の処理")
|
88
|
+
|
89
|
+
print(typesCount.Analyzer)
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
@IBAction func button4(_ sender: Any) {
|
98
|
+
|
99
|
+
typesCount.Analyzer[0] = 4
|
100
|
+
|
101
|
+
print("1回目の処理")
|
102
|
+
|
103
|
+
print(typesCount.Analyzer)
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
```SecondViewontroller
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
import UIKit
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
class SecondViewController: UIViewController {
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
var value2 = Typevalue()
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
override func viewDidLoad() {
|
136
|
+
|
137
|
+
super.viewDidLoad()
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
@IBAction func supporter1_1(_ sender: Any) {
|
148
|
+
|
149
|
+
value2.Analyzer[1] = 1
|
150
|
+
|
151
|
+
print("2回目の処理")
|
152
|
+
|
153
|
+
print(value2.Analyzer)
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
@IBAction func supporter1_2(_ sender: Any) {
|
160
|
+
|
161
|
+
value2.Analyzer[1] = 2
|
162
|
+
|
163
|
+
print("2回目の処理")
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
print(value2.Analyzer)
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
@IBAction func supporter1_3(_ sender: Any) {
|
176
|
+
|
177
|
+
value2.Analyzer[1] = 3
|
178
|
+
|
179
|
+
print("2回目の処理")
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
print(value2.Analyzer)
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
@IBAction func supporter1_4(_ sender: Any) {
|
188
|
+
|
189
|
+
value2.Analyzer[1] = 4
|
190
|
+
|
191
|
+
print("2回目の処理")
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
print(value2.Analyzer)
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
```
|