I Have an a touchesEnded event that checks for when a UITextField is pressed. What I would like it to do is is hide/show a UIPickerView. How can this be done?
Because I saw a comment about these solutions not working on iOS 7 I will assume this thread is still relevant and being searched for.
The best way I have found to do this is by attaching the UIPickerView to a (hidden)UITextField as the input view like:
_myPicker = [[UIPickerView alloc] init];
_myPicker.delegate = self;
_myPicker.showsSelectionIndicator = YES;
myTextField.inputView = _myPicker;
You can always hide the text field if desired. Then you can show/hide the UIPickerView by activating the textfield as first responder like:
[myTextField becomeFirstResponder];
[myTextField resignFirstResponder];
I have verified this works on iOS 7 and I have had it working as far back as iOS 5.