views:

33

answers:

1

Hi all,

I succesfully implemented a UIPickerView. However, I have a problem in selecting values.

According to the standard way, I have implemented the method

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { 
 // method implementation...
}

The problem is when I try to select the very first value. By default the first item is selected, so if I want the method to be called for the first row I have to scroll down, select a value, then scroll up to the first one again. What am I missing here ? Is there another way of doing this ? Also, is it possible to get selected value without moving the picker ? Because I have a view containing components as UITextField and UIPickerView and I am in need of scanning the whole view for getting components values.

thanks Leonardo

+1  A: 

You could use the selectedRowInComponent: method to get the selection without waiting for a use action.

Or if you want a user action, you could add a blank (or use-current, or no-selection, etc.) row somewhere and use the selectRow:inComponent:animated: method to select that.

hotpaw2
I look to the api, but I completely miss this method. I will go for it, thanks.
Leonardo