Ankit
Ankit

Reputation: 339

UIPicker and UITableView in iOS

I am new to iOS and confused about the right way to implement UIPickerView.

I have a UITableView (the list of which is populated by XML File). Now I want to implement an option to trim down that list (say, show only type X or type Y). Now the confusion is, should I implement the PickerView in TableView itself, or make a new segue to show PickerView.

I tried implementing the first one but couldn't get it working.

Upvotes: 0

Views: 252

Answers (1)

jrturton
jrturton

Reputation: 119242

A picker view wouldn't really fit inside a table view. You should have a button on the navigation bar or toolbar on your table view controller which presents a modal view controller holding your picker view.

This would then feed the selected value back to the table view controller (via a custom delegate protocol method, or similar) and the table view can filter its rows.

Upvotes: 1

Related Questions