我没有任何运气让我的textField填充了我的UIPickerview中的选定项目。 Pickerview中的行显示完美,但在选择项目时,我无法获得该值以保存到我的uitextfield中。
代码:
func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent
component: Int, cellForRowAtIndexPath indexPath: NSIndexPath) {
switch pDisplay
{
case .preparedby:
var u:SWUsers = arrPeople[row]
textField1.text = "\(u.fullName)"
println(u.fullName)
case .status:
textField2.text = txt2Array[row]
case .contractor:
var c:SWGContractors = arrContr[row]
textField10.text = c.name
println(c.name)
default:
break
}
}
数据来自我的coredata模型中的NSManageObject类。数组加载完美,我只需要获取所选行的值。任何想法都将不胜感激。
更新
我设置了断点,看起来它在以下情况后停止执行:
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
//return arrNo.count
switch pDisplay {
case .preparedby:
return arrPeople.count
case .status:
return txt2Array.count
case .contractor:
return arrContr.count
default:
return 0
}
} <--- stops here