I'm aware that this topic has been touched on before, but as far as I'm aware, never with any discussion of a possible workaround suitable for my situation.
The problem is that UISearchDisplayController doesn't seem to work inside custom ContainerView controllers. I've put up a sample project that demonstrates this problem in the simplest case I could imagine.
Is there any alternative way of containing the view controllers so that the UISearchDisplayController can work as normal?
My suspicion is that the UISearchDisplayController doesn't have a reference to the correct UINavigationController (although I have tried setting it up programatically in viewDidMoveToParentViewController, where the UINavigationController should have been set).
I had similar problems with an embedded UITableViewController. One of them was a missing UISearchBar after switching between UIViewControllers while the UISearchDisplayController is visible (I'm using SWRevealViewController to switch between UIViewController). This problem occurs only on iPads. It came out that the UISearchBar suddenly hides behind the UINavigationBar. Now I solved all my Problems with the following lines of code in the UITableViewController which is presented in a UIContainerView:
- (UINavigationController *)navigationController {
return nil;
}
Those lines prevent the UISearchDisplayController to reach and change the UINavigationController. I also subclassed this method into "MyContainerTableViewController" class and use this class now for all embedded UITableViewController.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With