Search code examples
iosuisearchdisplaycontroller

UISearchDisplayController won't show up


I'm confused right now.

I created a UIBarButtonSystemItemSearch and assigned it to self.navigationItem.rightBarButtonItem which shows up like it should:

enter image description here

When initializing the item I assign an action that should be executed and it does:

- (void)searchForLocation
{
    NSLog(@"search for location");
    [self.searchDisplayController setActive:YES animated:YES];
}

But the UISearchDisplayController is not showing up after that call.

What am I missing here?? Thank you!


Solution

  • A search display controller is not something that "shows up". It is a controller, not a view. - Also, it must be associated with a UISearchBar, but I don't see one in your interface. It is for displaying a table containing results of a search; it does not do the search (nor does it provide interface to let the user do the search; you must do that).