2011-01-13 26 views

回答

0

您可以使用選擇器的委託方法

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 

{ 

    if(component==0) 
    { 
     int i=row;  //here i returns the row selected by you in picker component 0 
    } 
    else if(component==1) 
    { 
     int j=row;  //here j returns the row selected by you in picker component 1 
    } 
    else if(component==2) 
    { 
     int k=row;  //here k returns the row selected by you in picker component 2 
    } 

} 
0

這取決於您如何決定將文本放置到組件中。

例如,如果你使用myArray

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 
{ 
    NSLog(@"%@",[myArray objectAtIndex:row]); 
} 
+0

感謝烏爾法,但我不是隻用在每個組件1個陣列, COMPONENT2和3與多陣列。 – miniHsieh 2011-01-13 05:49:35