PickerView selectedValue anyObject返回nil

时间:2014-11-14 10:41:45

标签: ios iphone swift uipickerview

我正在尝试返回名为picker的UIPickerView的selectedValue。问题是,无论我做什么,它总是返回零。这是怎么回事?

let done: ActionStringDoneBlock = {(picker: ActionSheetStringPicker!, selectedIndex: NSInteger!, selectedValue : AnyObject!) in
   prinln(selectedValue)    
}

1 个答案:

答案 0 :(得分:1)

原因是在完成阻止中展开NSInteger,尝试将NSInteger!更改为NSInteger,问题将得到解决。

let done: ActionStringDoneBlock = {(picker: ActionSheetStringPicker!, selectedIndex: NSInteger, selectedValue : AnyObject!) in
println(selectedValue)

}