When using UISearchDisplayController, the popover does not appear on the iPad widget controller

I created a UISearchDisplayController inside a UIViewController that lives inside a UINavigationController.

I used the usual init:

self.displayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
self.displayController.searchResultsDataSource = self;
self.displayController.searchResultsDelegate = self;
self.displayController.delegate = self;
self.displayController.displaysSearchBarInNavigationBar = YES;

This code works fine and shows a dull look on the iPhone, but on the iPad it does nothing. I watched online and most people say that it should automatically display a popover with the results. I don’t see it at all. Should I do it differently for iPad UIViewControllers?

I create all this programmatically.

+4
source share
1 answer

UISearchDisplayController ( PageSheet) iPad iOS7: UISearchDisplayController , iPhone.

, , tableView, UISearchDisplayController, :

- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
    {
        tableView.frame = self.view.frame;
        [self.view addSubview:tableView];
    }
}

:

  • , 50% self.view
  • , , UISearchDisplayController.

:

- (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView 
{
    tableView.contentInset = UIEdgeInsetsMake(44.f, 0.f, 0.f, 0.f); 
}
+6

All Articles