iosuisearchbaruisearchdisplaycontrolleruisearchbardelegateuisearchresultscontroller

searchDisplayController dim view stays after first search


I am using searchDisplayController for search functionality. On the click of the search button, I do folowing thing:

[mySearchBar becomeFirstResponder];

First time, everything works fine. I do following in searchDisplayControllerDidEndSearch (which will be called on cancel button event)

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
{
  [mySearchBar resignFirstResponder];
}

Now, on cancel button press, search bar hides also. Till that moment everything works fine. Now when second time I press search icon, search bar opens and even-though I type text and get search results, the dim view stays there.

I don’t know the problem is.


Solution

  • I solved it !!!

    Actually I was making a tiny mistake in order to hide/show the Tableview of search display controller as following:

    -(IBAction)searchButton_Action:(id)sender
    {
        //
        //
        self.searchDisplayController.searchResultsTableView.hidden = FALSE;
        //
        //
    }
    

    We should not do this on our own programatically because searchDisplayController itself manages its TableView.