一般是在 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
中判断用户选择的组和行数。如果同时滚动两组或则两组以上,这个函数只会回调一次,所以如果只是简单取row和component的值,那其它组(component)的行数值(row)的更改就不会生效,所以正确的方式应该是:
NSInteger iRow0 = [pickerView selectedRowInComponent:0];
NSInteger iRow1 = [pickerView selectedRowInComponent:1];
就是在本函数中取所有组的当前选中的行数,确保所有更改生效!
本文介绍如何在iOS开发中实现UIPickerView多组联动效果。当用户滚动选择器时,需在-(void)pickerView:didSelectRow:inComponent:方法中获取所有组件的当前选中行数,以确保所有更改生效。
2003

被折叠的 条评论
为什么被折叠?



