Search code examples
ipaduitableviewsearchsearchdisplaycontroller

searchResultsTableView takes entire screen on ipad


I am working on a app for the iPad which has a tableView on the left and a view on the right. We are not using the UISplitViewController.

I have been able to setup filtered results using the Search Display Controller and a search bar, but the search results take up the entire screen.

Ideally, I would like to have the search results only take up the same amount of screen as our tableView. Or, barring that, have a way to dismiss the search results when 'didSelectRowAtIndexPath' is activated.

I'm not sure what code I should post. I'm using the code from the Apple code sample: TableSearch.

  • on the comment below: something like this..?

    [self.searchDisplayController.searchResultsTableView setFrame:myTableView.view];


Solution

  • By default, table views take up the whole screen, but there is nothing stopping you from setting their frame.

    Just call -setFrame on the searchResultsTableView property of your search display controller.