I am using the ABPeoplePickerNavigationController
class provided by Apple to let the user pick a contact.
In this list the user can start searching by tapping into the searchBar. However I want that the user doesn't need to tap the searchBar and therefore I want to automatically enter into search mode after presenting the view controller.
For searchBar you can normally enter searchMode by calling searchDisplayController setActive:YES animated:YES
. This However does not seem to work using the ABPeoplePickerNavigationController
.
That is what I tried:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
[self presentViewController:picker animated:YES completion:^{
[picker.searchDisplayController.searchBar becomeFirstResponder];
[picker.searchDisplayController setActive:YES animated:YES];
}];