OK, I've got your answer-
Here are the steps that worked for me [containing some pseudocode]:
1) Since you are searching you are most certainly already overriding ShouldReloadForSearch
- So just add piece of code that saves/stores the forSeachString
.
2) This one may vary quite a bit depending on your app- but the gist for this step is that you need to clear out the stored search string [set to null] if no search results are loaded. I did this in my UITableViewSource. I have 2 constructors- one for the full dataset and another on for the filtered [search results] dataset. So I just set it to null in my full dataset constructor. Yeah, you could do it differently no doubt but that's how I did it.
3) Next, do as the original "answer" states and call SetActive - [self.searchDisplayController setActive:NO];
. They advocated doing it in override of ViewDidAppear. I didn't do that... I did this immediately after I pushed the next UIViewController in my RowSelected
override.
4) Last, within your UIViewController that has the UISearchDisplayController attached- check for your saved search string and if it exists then do the following: 1) call SetActive again BUT this time with a true parameter ie setActive:YES
... then 2) set the searchBar text to your saved search string value. I did this in the ViewWillAppear
override.
Long story short... this worked for me AND it maintains the search results. Setting the searchBar text in step 4 is the key... this effectively gets the filter to persist.
Hope this helps someone