I have UISearchController and a UITableView. The Code in viewDidLoad is:
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = YES;
[self.searchController.searchBar sizeToFit];
self.searchController.searchBar.delegate = self;
self.searchController.delegate = self;
self.tableView.tableHeaderView = self.searchController.searchBar;
self.tableView.userInteractionEnabled = YES;
I want the grey view to be appeared whenever I tap on the search bar and when I start typing, the grey view disappears and shows the tableView so I can tap on the cells. Thats mean the grey view appears only when the search bar is empty (just like the default search behavior in Mail and Contacts Apps). I tried to set the
self.searchController.dimsBackgroundDuringPresentation
in the delegate method based on the searchBar.text
-(void )searchBarTextDidBeginEditing:(UISearchBar *)searchBar
but it does not work. Any ideas?
Thanks,