比方说我的UIPickerView
中有一个ViewController
。启动后,我在这里使用此代码:
[picker selectRow:3 inComponent:0 animated:NO];
选择我想要的行后,为什么不触发didSelectRow
代码?
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {}
关于这是为什么以及如何解决这个问题的任何想法?感谢
答案 0 :(得分:0)
我解决此问题的方法是只添加一个空白行并将选取器加载到空白行。这会强制用户滑动UIPickerView
,以便didSelectRow
被触发。