我在iPhone应用程序中使用多个UIPickerView
。我的问题是,如何处理多个UIPickerView
句柄事件?
另外,我想将所选值放在UITextField
的{{1}}中。
答案 0 :(得分:11)
答案 1 :(得分:1)
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
NSInteger counter;
if(pickerView==p1)
{
counter=[name count];
}
else
{
counter=[name2 count];
}
return counter;
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
if(pickerView==p1)
return [name objectAtIndex:row];//name is NsMutable Array
else
return [name2 objectAtIndex:row];//name2 is NsMutable Array
}