UISearchController showing fullscreen instead of a popup on iPad

I want to build a search control like the maps app; the search opens a result tableview (which works fine) on iPhone and should open a tableview in a popover on iPad. This used to be automatic in UIsearchDisplayController but does not work anymore and it shows a fullscreen tableview on iPad.

self.resultsController = [[EFResultTableViewController alloc] init];
[self.resultsController.tableView setDelegate:(id<UITableViewDelegate>)self];

self.searchController =
    [[UISearchController alloc] initWithSearchResultsController:self.resultsController];
[self.searchController setSearchResultsUpdater:(id<UISearchResultsUpdating>)self];

self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
[self.searchController.searchBar setBarTintColor:[UIColor whiteColor]];

[self.searchController.searchBar setDelegate:(id<UISearchBarDelegate>)self];
self.definesPresentationContext = YES;

ResultTableViewController is just a customised tableview nothing. I do not want to write IS_IPAD conditional code. Is there anything I am missing here.

Source: ios

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.