I have my UIPickerView
hooked into a UITextField's
inputView. I have it popping up. I know when the user selects a row. I know the value for the row. All that is great.
My question deals with when to dismiss the picker. I've seen people marry a toolbar with [Cancel] and [Done] to the picker and dismiss it on either button click. This is probably the best approach as the user can back out of their choice.
I've also seen one app where the user scrolls to the selection they want and then presses it again to dismisses the picker. I would like to know how to do this. I have noticed that once the picker informs you of a specific row being selected, it will not inform you again if the user continues to click/press on the same active row.
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
Hey UserDano since you have added the picker as an ipnputView to the text field you can call
[outletForTextField resignFirstResponder]
and this will help you resign the pickerView . Now The way you want to do this is on first selection you want to Select the value and on second selecteion (for same row) you want to hide the Picker.So keeping a Bool value to store the selected value and later using it to remove the picker when same row is selected might do the trick. Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With