Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally found a way to do this. </p> <p>I found out that the searchDisplayController simply removes the searchResultsTableView from the superview, so I just added the table view back into the superview whenever the display controller tried to hide the table view:</p> <pre><code>- (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView { // add the tableview back in [self.view addSubview:self.searchDisplayController.searchResultsTableView]; } </code></pre> <p>and then I also have to show the tableview the first time the searchbar is clicked, so I did: </p> <pre><code>- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { // after the data has been preloaded self.searchResults = self.allItems; [self.searchDisplayController.searchResultsTableView reloadData]; } - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller { [self.view addSubview:self.searchDisplayController.searchResultsTableView]; } </code></pre> <p>For me, 'allItems' is where I stored all the searchable items and 'searchResults' is where the filtered items (after the search) is stored. And of course, you would have to preload the items (e.g. search history) before reloading the data. </p> <p>I don't know if this is a nice way or not to do it in terms of the performance and what not, but it worked perfectly for me, and I hope this could be useful for other people as well. Please comment if there is a better way to do this. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload