Search code examples
iosuitableviewuitextfielduipickerview

Mixed UIPicker & TextField in TableView


I've setup a TableView with 4 UITextFields that I want the user to be able to input some information into. 2 of the text fields when pressed need to present a UIPickerView to select an option, instead of the keyboard. Each PickerView needs to display a separate array of items.

Does anyone know how I can accomplish this? This is the closest i've come to finding a solution:

How to use one UIPickerView for multiple textfields in one view?

I can get the Picker to show up correctly but only show an one array and every text field in the cell shows the same picker.


Solution

  • I love this answer, which is why I link to it when I can:

    https://stackoverflow.com/a/8583703/220820

    You could fill your picker with data whenever a text field becomes first responder for its inputView (its keyboard replacement).