1

在我的视图控制器中,当我实例化我的UISearchDisplayController对象时,我设置了它的各种属性,包括属性的背景颜色searchResultsTableView

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];

当我在“正常”非搜索表视图中时,我使用这种方法为搜索栏上方的空间着色,这在那里正常工作。

但是,该tableViewHeaderBackground视图似乎不是此搜索显示控制器的表视图的子视图。我没有看到defaultBackgroundTint我应用于此子视图的内容。

是否有正确的方法将背景色调添加到搜索结果表视图的“外部”?

4

0 回答 0