views:

40

answers:

0

In my view controller, when I instantiate my UISearchDisplayController object, I set its various properties, including the background color of the searchResultsTableView property:

self.searchDisplayController = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
searchDisplayController.searchResultsDelegate = self;

UIView *tableViewHeaderBackground = [[UIView alloc] initWithFrame:CGRectMake(0,-480,480,480)];
tableViewHeaderBackground.backgroundColor = [UIAppDelegate defaultBackgroundTint];  
[searchDisplayController.searchResultsTableView addSubview:tableViewHeaderBackground];
[tableViewHeaderBackground release];

I use this approach for coloring the space above the search bar when I am in the "normal" non-search table view, and this works properly there.

However, the tableViewHeaderBackground view does not appear to be a subview of this search display controller's table view. I do not see the defaultBackgroundTint that I applied to this subview.

Is there a correct way to add a background tint to the "outside" of the search results table view?