I use the UISearchViewController in a somewhat unconventional way.
My UISearchBar is initially hidden. When the user clicks the button, I show the UISearchBar and activate the UISearchViewController. I also set the text of the search bar and told the search bar to become the first responder.
The problem is that the gray overlay created by the UISearchDisplayController remains visible. This does not disappear if the text that I set is cleared and the user starts to type the text again.
self.searchDisplayController.searchBar.hidden = NO;
self.searchDisplayController.searchBar.text = @"term";
[self.searchDisplayController.searchBar becomeFirstResponder];
[self.searchDisplayController setActive: YES animated: YES];
Why does the UISearchDisplayController continue to show a gray overlay and how to clear it?
source
share