According to the documentation, if a UIPickerView has no selected value, the expected return from selectedRowInComponent: should be:
"A zero-indexed number identifying the selected row, or -1 if no row is selected."
However, if I check the value the very line after initializing one, its value is 0. Even if I then manually set it to -1, it still returns 0. I would like to be able to detect whether the user has chosen a value yet or not, without recording it in a local variable. Is this possible?
example:
UIPickerView *picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 46.0, 320.0, 216.0)];
[picker selectRow:-1 inComponent:0 animated:NO];
NSLog(@"SELECTED %d", [picker selectedRowInComponent:0]);
expected output:
SELECTED -1
actual output:
SELECTED 0