下面假设component数量为2。
使用指定title的函数,根据[pickerView selectedRowInComponent:0]的不同来指定第二个component的title
复制代码- (NSString*)pickerView:(UIPickerView*)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
}
但此时,会发现切换省份后,城市一栏没有办法及时刷新。
我们还要指定刷新事件。
复制代码- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
[pickerView reloadComponent:1];
}
注:相关教程知识阅读请移步到IOS开发频道。










