I have an issue with my UISearchBar created programatically in popover (which is a subclass of tableviewcontroller). Everything is working fine but there is one thing which drains my blood. When searching among all records in table - the result is displayed over these all records. Lets see a picture of table which I get after searching for some rubbish.
The scrollable result table (empty) and, as a background, all records table (cannot be clicked). Here goes my code snippets.
CustomerPickerViewController.h
@interface CustomerPickerViewController : UITableViewController <UISearchDisplayDelegate, UISearchBarDelegate>{
UISearchDisplayController *searchDisplayController;
}
CustomerPickerViewController.m
//set up searchbar
UISearchBar *searchBar = [[UISearchBar alloc] init];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
searchBar.delegate = self;
//set up searchDisplayController with search bar
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
searchDisplayController.searchResultsDelegate = self;
//place searchBar in the header
self.tableView.tableHeaderView = searchBar;
To make it more obvious, see this search result which is covering full records table. This background table can be seen once I slide first cell down.
How can I have just white background behind my search result?
Thanks a lot.