I have an annoying problem. I have an UINavigationController with an UITableView in the Master (Left) pane of my UISplitViewController. When I do normal operations, things push on on to the navigation controller fine.
alt text http://files.droplr.com/files/8851942/WDO5y.working.jpg
However, when I do a search and push things on, it’s like it doesn’t account for the space the navigation bar needs. It pushed the new controller on at the very top, then puts the navbar on, overlapping the content!
alt text http://files.droplr.com/files/8851942/WDRem.search.jpg
I should add it works fine when doing it in portrait (in the popup menu) and on the iphone. Is this an UISplitViewController bug?
OK, I’ve got your answer- [I also posted this answer to the linked question]-
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 theforSeachString.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 myRowSelectedoverride.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 theViewWillAppearoverride.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