我有一個選取器視圖。我能夠從採集器視圖中捕獲String
,但實際上我只是想要index
。我想,也許在selectedRow(InComponent: Int)
會的工作,但是當我嘗試這個,我得到一個崩潰說UIPickerView索引作爲Int
指數2超出範圍[0 .. 0]
這是我想
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, InComponent component: Int) {
timeFrame = fixedAmountPickerView.selectedRow(inComponent: row)
}
如何才能將Index
設置爲Int
?
嘗試使用'pickerView.selectedRow(inComponent:row)' –
Wouldn'你使用pickerView(:didSelectRow:component')的'row'參數嗎? – AgRizzo