How to activate a UISearchDisplayController

We can do this two ways:

    // version 1:
    [self.searchBar becomeFirstResponder];

    // version 2:
    [self.searchDisplayController setActive:YES animated:YES];

The benefit of version 2 is that if we perform it “in vision”, we can use the animated option and make it look all swish.

Version 2 of course also has a reverse with which we can deactivate the controller:

    [self.searchDisplayController setActive:NO animated:YES];

Note that this will not affect the UISearchBar associated with the search display controller; you need to deal with that separately.





Leave a Reply