回答編集履歴
1
修正
answer
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
// ↓ 追加
|
15
15
|
var dataList: [String] = []
|
16
16
|
|
17
|
+
let myPicker = UIPickerView()
|
18
|
+
|
17
19
|
@IBOutlet weak var sexText: UITextField!
|
18
20
|
@IBOutlet weak var addressText: UITextField!
|
19
21
|
|
@@ -27,8 +29,6 @@
|
|
27
29
|
addressText.tag = 2
|
28
30
|
|
29
31
|
|
30
|
-
let myPicker = UIPickerView()
|
31
|
-
|
32
32
|
myPicker.delegate = self
|
33
33
|
myPicker.dataSource = self
|
34
34
|
|
@@ -50,10 +50,10 @@
|
|
50
50
|
// ↓ 追加
|
51
51
|
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
|
52
52
|
dataList = textField.tag == 1 ? sexList : addressList
|
53
|
+
myPicker.reloadAllComponents()
|
53
54
|
return true
|
54
55
|
}
|
55
56
|
|
56
|
-
|
57
57
|
override func didReceiveMemoryWarning() {
|
58
58
|
super.didReceiveMemoryWarning()
|
59
59
|
}
|