2
私は以下のようにテキストフィールドにUIPickerView
を実装しています:1つのページに複数のUIPickerViewを実装するにはどうすればよいですか?
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)
}
私はUIPickerView
を実装する別のテキストフィールドを持っていると思います。私はどうすればいいのですか?上記の実装されたメソッドを両方のテキストフィールドを含むように変更できますか?