0
votes

First of all, apologize because I have seen some posts about this, but I can not understand them. My problem is this: I have a UIPickerView that gets the values ​​from an NSArray. Everything working perfect except when I get the value of the first row of the picker. I have read that the method - (void) pickerView: (UIPickerView *) pickerView didSelectRow: (NSInteger) row inComponent: (NSInteger) component only runs when users scroll up or down in the picker. So how I can get in a NSString the first value of picker? This is my method:

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

 NSLog (@ "are in line% i", row);

 NSLog (@ "You've selected,% @", [array objectAtIndex: row]);

}

I have an array called "array" that he contains the data;

Thanks so much!

1

1 Answers

1
votes

A lot people have faced similar problem (what if person selects default value in UIPickerView) and you might want to checkout following post in order to fix your particular problem:
https://stackoverflow.com/a/789633/200272