質問編集履歴
2
```を追加してみました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
```swift
|
20
|
+
|
19
21
|
import UIKit
|
20
22
|
|
21
23
|
|
@@ -180,7 +182,7 @@
|
|
180
182
|
|
181
183
|
}
|
182
184
|
|
183
|
-
|
185
|
+
```
|
184
186
|
|
185
187
|
|
186
188
|
|
1
ソースを全体載せました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,46 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
import UIKit
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
class ViewController: UIViewController {
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
override func viewDidLoad() {
|
28
|
+
|
29
|
+
super.viewDidLoad()
|
30
|
+
|
31
|
+
// Do any additional setup after loading the view.
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
@IBOutlet weak var answerImageView: UIImageView!
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
@IBOutlet weak var answerLabel: UILabel!
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
// じゃんけん(数字)
|
52
|
+
|
53
|
+
var answerNumber = 0
|
54
|
+
|
55
|
+
var ButtonAction = 0
|
56
|
+
|
57
|
+
|
58
|
+
|
19
59
|
// UIImage の配列を作る
|
20
60
|
|
21
61
|
var imageListArray :Array<UIImage> = []
|
@@ -44,6 +84,106 @@
|
|
44
84
|
|
45
85
|
imageListArray.append(image3)
|
46
86
|
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
@IBAction func shuffleAction(_ sender: Any) {
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
if answerNumber == 0 {
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
answerLabel.text = "じゃんけん!!!!"
|
102
|
+
|
103
|
+
answerNumber = 99
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
// return;
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
answerNumber = Int.random(in: 0..<3)
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
if answerNumber == 0 {
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
// グー
|
128
|
+
|
129
|
+
answerLabel.text = "グー"
|
130
|
+
|
131
|
+
answerImageView.image = UIImage(named:"gu")
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
} else if answerNumber == 1 {
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
// チョキ
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
answerLabel.text = "チョキ"
|
144
|
+
|
145
|
+
answerImageView.image = UIImage(named:"choki")
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
} else if answerNumber == 2{
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
// パー
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
answerLabel.text = "パー"
|
158
|
+
|
159
|
+
answerImageView.image = UIImage(named:"pa")
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
ButtonAction = 99
|
168
|
+
|
169
|
+
answerNumber = 0
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
47
187
|
|
48
188
|
|
49
189
|
エラー箇所は下記です。
|