0

I have a UITableView with a searchbar. I have a separate page (accessed via a tabBarController) of search tools that can query the data in a number of ways.

The difficulty I'm having is that when I search the data using the custom search tools, I'm filtering the actual tableView, not the UISearchDisplayController's searchResultsTableView.

I would like my custom query tools to effect the searchResultsTableView, but I can not find a way to access it. Also, when I return to the table after using the search tools, the original table is displayed, how can I display the searchResultsTableView?

Any ideas?

Thanks!

Jonah
  • 4,810
  • 14
  • 63
  • 76

1 Answers1

1

How are you populating the searchResultsTableView?

It might be a good idea to keep a separate dataset (maybe an NSArray) for that. When searching begins, matching items would get added to that dataset that, in turn, would be used to populate the searchResultsTableView.

That way, it would be a matter of filtering that specific dataset instead of the original one when using those custom search tools.

As for showing the searchResultsTableView when returning to the view, it depends on what is actually done when moving away from that view. Usual strategies are using setActive:YES on your UISearchDisplayController or storing the search string somewhere and calling setText:SEARCH_STRING on UISearchDisplayController's search bar after returning and retrieving that string.

Aloha Silver
  • 1,394
  • 17
  • 35