Reputation: 195
The way I have my picker view setup is to change a text field when I select one of the options.
[dataArray addObject:@"1"];
[dataArray addObject:@"2"];
[dataArray addObject:@"3"];
When I tried to select the first option on the first load it wont change text field. However I can select the first option in the UIPickerView if I scroll up a little and then let it drop down on first option or scroll to option 2 then scroll back up to option 1. Is there a way to detect touch on first option and let it select it and change to that option? If so, what is the best course of action to doing this.
Upvotes: 2
Views: 4825
Reputation: 57040
If I understand correctly, you are using the delegate to be notified of changes to selection in the picker view and set your text field accordingly? If so, you can call [self pickerView:self.pickerView didSelectRow:0 inComponent:0]
after the picker view has been loaded, so that the first element appears in the text field.
Upvotes: 3