How do I present a UISearchController like the calendar app?

I am able to create a search UI like the iOS 7/8 calendar app (search icon drops down UISearchBar) by following the example in UICatalog of calling presentViewController: on my UISearchController. The problem is I can't seem to find a way to push a VC onto my stack after selecting a search result. In Apple's example there is no navigation controller to push onto besides the one that presented the UISearchController but I can't push onto it since it is presenting the UISearchController. So I tried to wrap my results view controller in a UINavigationController and push from there. It looks like it is going to work but once I select a result it pushes about halfway then the results disappear and I just see the dimmed view of the UISearchController. Also wrapping the UISearchController in a nav controller and presenting it didn't work either. Any ideas?

Did you find a solution for this? I have exactly the same problem.

I ran into a similar issue, and the solution for me was to:


self.definesPresentationContext = YES;


for the view controller that presents the search controller.


So I ended up with:

- The base navigation controller

- a base view controller inside that nav controller (this has its definesPresentationContext set)

- the search view controller, presented from the above view controller

- search results are pushed onto the above navigation controller

I am also trying to achieve the same effect as in the iOS Calendar App. Setting `self.definesPresentationContext = true` appears to be necessary for the navigation controller to work but it also leads to the search bar being hidden behind the navigation bar. It works fine with `searchController.hidesNavigationBarDuringPresentation = true` but this leads to glitches during the presentation animation.


Could you elaborate how you implemented this in such a way that the search controller is presented upon pressing a bar button item?


Did you also find a way to make the search bar the first responder, thus showing the keyboard, when it is presented from the bar button item?

How do I present a UISearchController like the calendar app?
 
 
Q