質問編集履歴
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
//AppDelegteにcomposで選択された値を格納
|
106
106
|
|
107
|
-
appDelegate?.size = compos
|
107
|
+
appDelegate?.size = compos //エラーを吐く
|
108
108
|
|
109
109
|
}
|
110
110
|
|
@@ -132,53 +132,23 @@
|
|
132
132
|
|
133
133
|
```ViewController1
|
134
134
|
|
135
|
-
|
135
|
+
var compos = ["四角","長方形","円","楕円"] //修正箇所
|
136
136
|
|
137
|
-
|
137
|
+
.
|
138
138
|
|
139
|
-
|
139
|
+
.
|
140
140
|
|
141
|
-
var compos = ["四角","長方形","円","楕円"]
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
// PickerViewに必要な処理
|
146
|
-
|
147
|
-
override func didReceiveMemoryWarning() {
|
148
|
-
|
149
|
-
super.didReceiveMemoryWarning()
|
150
|
-
|
151
|
-
|
141
|
+
.
|
152
|
-
|
153
|
-
|
154
142
|
|
155
143
|
|
156
144
|
|
157
|
-
func numberOfComponents(in pickerView: UIPickerView) -> Int {
|
158
145
|
|
159
|
-
|
160
|
-
|
161
|
-
return 1
|
162
|
-
|
163
|
-
}
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
return compos.count
|
172
|
-
|
173
|
-
}
|
174
|
-
|
175
|
-
|
176
146
|
|
177
147
|
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
|
178
148
|
|
179
149
|
|
180
150
|
|
181
|
-
return compos[row]
|
151
|
+
return compos[row]//修正箇所
|
182
152
|
|
183
153
|
}
|
184
154
|
|
@@ -190,7 +160,7 @@
|
|
190
160
|
|
191
161
|
|
192
162
|
|
193
|
-
label.text = compos[row]
|
163
|
+
label.text = compos[row]//修正箇所
|
194
164
|
|
195
165
|
|
196
166
|
|
@@ -198,24 +168,4 @@
|
|
198
168
|
|
199
169
|
|
200
170
|
|
201
|
-
//=====================================
|
202
|
-
|
203
|
-
// KetteiButton が押されたときの処理
|
204
|
-
|
205
|
-
//=====================================
|
206
|
-
|
207
|
-
//AppDelegteにcomposで選択された値を格納
|
208
|
-
|
209
|
-
func onClickKettei(sender: UIBarButtonItem)
|
210
|
-
|
211
|
-
{ appDelegate = UIApplication.shared.delegate as? AppDelegate
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
appDelegate?.consentsize = compos
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
171
|
```
|
1
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -123,3 +123,99 @@
|
|
123
123
|
|
124
124
|
|
125
125
|
色々とおかしな点があると思いますが解決策を考えてくださると嬉しいです。
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
コメントをいただき以下のように修正しました。
|
130
|
+
|
131
|
+
エラーは同じ物を吐いているままです。
|
132
|
+
|
133
|
+
```ViewController1
|
134
|
+
|
135
|
+
@IBOutlet weak var myPickerView: UIPickerView!
|
136
|
+
|
137
|
+
@IBOutlet weak var KetteiButton: UIButton!
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
var compos = ["四角","長方形","円","楕円"]
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
// PickerViewに必要な処理
|
146
|
+
|
147
|
+
override func didReceiveMemoryWarning() {
|
148
|
+
|
149
|
+
super.didReceiveMemoryWarning()
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
func numberOfComponents(in pickerView: UIPickerView) -> Int {
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
return 1
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
return compos.count
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
return compos[row]
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
//項目が選ばれた
|
188
|
+
|
189
|
+
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
label.text = compos[row]
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
//=====================================
|
202
|
+
|
203
|
+
// KetteiButton が押されたときの処理
|
204
|
+
|
205
|
+
//=====================================
|
206
|
+
|
207
|
+
//AppDelegteにcomposで選択された値を格納
|
208
|
+
|
209
|
+
func onClickKettei(sender: UIBarButtonItem)
|
210
|
+
|
211
|
+
{ appDelegate = UIApplication.shared.delegate as? AppDelegate
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
appDelegate?.consentsize = compos
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
```
|