I have an application that asynchronously searches for a remote API and displays the user interface using iOS 'UISearchDisplayController.
For the saved search function, I try to programmatically use the UISearchDisplayController to both initiate the search and customize the user interface when it was where it was before. (That is, I'm trying to open the search bar and ask a search query.)
searchTableViewController.searchDisplayController.searchBar.text = mySearchTerm;
[searchTableViewController.searchDisplayController setActive:YES animated:YES];
[searchTableViewController performSearch];
The code I tried so far is not like a trick. As long as it correctly displays the search string, sets the search query and performs the search, the system does not seem to somehow recognize this as a valid search. If I use my fingers in the presentation of the results so that the keyboard disappears, the search term is reset and the results disappear.


Help evaluate. Thank!
source
share