I have a UIPickerView set as the input of a UITextField. How can I know when the user pressed on the UITextField?
I've tried with the TouchDown
and EditingDidStart
events but they won't trigger.
The code where I link the event to a method is the following
myTextField.addTarget(self, action: #selector(myMethod), for: .<Event>)
Use delegate's method func textFieldDidBeginEditing(_ textField: UITextField)
of UITextFieldDelegate
and don't forget to become textfield delegate like yourTextField.delegate = self
https://developer.apple.com/documentation/uikit/uitextfielddelegate/1619590-textfielddidbeginediting