0
選択したpickerViewの値を取得する正しい方法が何であるのだろうか。スウィフトiosはpickerViewから選択された値を取得します
var timeLeft: Int?
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView.tag == 0 {
TimeLeftBtnLabel.text = TimeLeftPickerData[row]
timeLeft = row
}
}
または私はこのようにそれを実行する必要があります:
は今、私のコードは次のようである
var timeLeft: Int?
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if pickerView.tag == 0 {
TimeLeftBtnLabel.text = TimeLeftPickerData[row]
timeLeft = TimeLeftPicker.selectedRowInComponent(0)
}
}