views:

265

answers:

1

How do you remove the transparent black overlay that animates over the source table view when you activate a UISearchBar?

Can you somehow get to the UIView responsible and set it's alpha to 0?

Or is there a way to display an empty searchResultsTableView on top of the black overlay?

A: 

Always have it display some cells, even if there aren't any results from the search yet. You can accomplish this through the usual UITableViewDelegate/UITableViewDataSource methods. Just be careful because you now are dealing with the original table view, the search table view, and the search table view with dummy cells in it, and all the UITableViewDelegate/UITableViewDataSource methods need to be aware of this.

refulgentis
How do I set the UISearchDisplayControllerDelegate.searchResultsTableView to have a different datasource when it first loads? And then switch to the searchResults datasource when someone starts searching?
billabel
If I were you, I'd use the same data source, and just check if ([filteredListContent count] == 0). If so, return some blank cells, (tableView height/row height) number of rows per section, 1 section, and just deselect any row that is selected.
refulgentis
In fact, now that I look at the documentation, that may be the only way as there's no way to observe the text in the UISearchBar for changes.
refulgentis
Looking at the documentation, I don't think my question was clear enough. I'm trying to display the empty search results before a searchString has been defined. It doesn't look like that is possible.
billabel
Like all good things, it's not possible in a non-slightly hacky fashion. I'll post a fuller solution in an edit later.
refulgentis