Added a pickerView using a UITextField.
I am trying to trigger the pickerView programmatically.
func myTypeDetector (textfield: UITextField) {
typeLabel.delegate = self
self.setType(textField: typeLabel)
}
override func viewDidLoad() {
super.viewDidLoad()
typeLabel.addTarget(self, action: #selector(NewSpeciesVC.myTypeDetector(textfield:)), for: UIControlEvents.touchUpInside)
}
I have found how to do this via UIButton
self.typeLabel.sendActions(for: .touchUpInside)
However, this is not working for the UITextField.
I would like to programmatically create the event with the TextField, or create the PickerView event using a UIButton.
Any suggestions?
I needed to do the same thing and figured it out:
self.typelabel.becomeFirstResponder()