Search code examples
swiftuitextfielduisearchbaruipickerview

Search bar at the top of a UIPickerView in Swift


So I have a textField, which when the user presses, it shows a UIPickerView, which is populated from an array.

Is it possible for there to be search bar at the top of the pickerView, so the user can search for something in the pickerView?

I've not seen this done before so have no idea if it's possible?

Thanks in advance.


Solution

  • UIPickerView is really meant for a few options - if you need to present something that has a lot more options, I would suggest a table view with a search bar. Search Bar Tutorial is a good start.