回答編集履歴
2
修正
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
`PickerView`の`tag`プロパティで判別すると
|
1
|
+
`PickerView`の`tag`プロパティで判別するのが簡単だと思いますよ。
|
2
2
|
|
3
3
|
|
4
4
|
|
1
修正
test
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
pickerView1.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: pickerView1.bounds.size.height)
|
44
44
|
|
45
|
-
pickerView1.tag = 1
|
45
|
+
pickerView1.tag = 1 // <<<<<<<<<< 追加
|
46
46
|
|
47
47
|
pickerView1.delegate = self
|
48
48
|
|
@@ -88,7 +88,7 @@
|
|
88
88
|
|
89
89
|
pickerView2.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: pickerView2.bounds.size.height)
|
90
90
|
|
91
|
-
pickerView2.tag = 2
|
91
|
+
pickerView2.tag = 2 // <<<<<<<<<< 追加
|
92
92
|
|
93
93
|
pickerView2.delegate = self
|
94
94
|
|
@@ -144,7 +144,7 @@
|
|
144
144
|
|
145
145
|
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
|
146
146
|
|
147
|
-
if pickerView.tag == 1 {
|
147
|
+
if pickerView.tag == 1 { // <<<<<<<<<< 変更
|
148
148
|
|
149
149
|
return array1[row]
|
150
150
|
|
@@ -168,7 +168,7 @@
|
|
168
168
|
|
169
169
|
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
|
170
170
|
|
171
|
-
if pickerView.tag == 1 {
|
171
|
+
if pickerView.tag == 1 { // <<<<<<<<<< 変更
|
172
172
|
|
173
173
|
return array1.count
|
174
174
|
|
@@ -184,7 +184,7 @@
|
|
184
184
|
|
185
185
|
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
|
186
186
|
|
187
|
-
if pickerView.tag == 1 {
|
187
|
+
if pickerView.tag == 1 { // <<<<<<<<<< 変更
|
188
188
|
|
189
189
|
textField1.text = array1[row]
|
190
190
|
|