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.





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.