我有一个UIPickerView
包含两个组件的组件,当我更改component[0] the data of the
组件 [1] 时会重新加载。
现在我试图在一个字符串中获取两个组件的值,didSelectRow
但是,我无法得到我想要的结果。
public func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
if component == 0 {
String0 = arr0[row]
pickerView.reloadComponent(1)
}
if component == 1{
String1 = arr1[row]
}
print("\(String0), \(String1)")
// result: " , string1.value"
}
当我选择component[0]
结果更改但仅用于String0
我想要实现的是得到"string0.value, string1.value"