I am implementing UIPickerView in a text field as below:
public func numberOfComponents(in pickerView: UIPickerView) -> Int{
return 1
}
public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return states.count // states is an array of strings
}
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return states[row]
}
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
textField.text = states[row]
self.view.endEditing(false)
}
I want to have another textfield that implement UIPickerView. How should I do it? Can I alter the methods implemented above to include both text fields?