-1
-(NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return [pickerArray objectAtIndex:row];
}

pickerArray is the name of the array having the elements which are going to be shown in the UIPickerView.

If my Picker has 3 components, then the upper method fills everyone of them with he same array. How to fill it with different ones ?

4

1 回答 1

2

the component argument in the call is an integer value indicating que "wheel" that is filling, use something like this:

if (component == 0)
    return [pickerArray_0 objectAtIndex:row];
else if (component == 1)
    return [pickerArray_1 objectAtIndex:row];
else
    return [pickerArray_2 objectAtIndex:row];
于 2012-11-21T10:51:51.833 回答