-1
私はモーダルウィンドウでUIpickerを持っています。 1つのことを除いて、すべてうまく動作します。ユーザーが入力テキストフィールドをクリックすると、UIpickerViewのモーダルウィンドウが期待通りに開きます。選択した行が正しい行で、ユーザーが[OK]ボタンをクリックすると、現在のコードは値を登録できません。UIPicker - ユーザーがOKボタンをクリックするだけで標準のselectedRowを記録する方法
// Set the default row, so if user click ok without changing it is recorded
self.picker.selectRow(0, inComponent: 0, animated: false)
didSelectRowの代替手段はありますか?彼らはすでにコードによってあらかじめ選択されているので、ユーザーは行を選択しないので、それが問題だと思います。
// Capture the picker selection
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
// This method is triggered whenever the user makes a change to the picker selection.
// The parameter named row and component represents what was selected.
selectedType = pickerData[row] as String
}
時には最も明白でさえも見るのが難しい.... –