I have one mainViewController and I have a UIPickerView. Now all is set up well, but when I run the app and select the textField I get Question Marks in my UIPickerView list.
Now I have just learned that, that is because I have not connected the delegate for it.
However if I connect the delegate for it, then the textField does not get populated.
The TextField is in mainViewController.
So in my MainViewController.h I have imported the UIPickerView and have this code – which is all without errors. _pv is the UIPickerView.
_pv = [[CategoryPicker alloc] init];
[_pv.categoryPicker setDelegate:self];
[_pv.categoryPicker setDataSource:_pv];
[_appPriorityTxtFld setInputView:_pv];
[_appPriorityTxtFld setInputAccessoryView:toolbar];
Now as you can see the Delegate is set to self, this will allow for the textField to be populated.
If I set that to _pv the then I get the list displayed properly, but the textField is not populated.
What am I missing??
Cheers
You need to implement the picker delegate method “pickerView:didSelectRow:inComponent:” and you need to set the selected text as textfild text. see the following code for reference,
I think this may useful.