我有一个UITableView
with a searchDisplayController
实施的。我有
tableView.backgroundColor = [UIColor clearColor];
and
self.searchDisplayController.searchResultsTableview.backgroundColor = [UIColor clearColor];
当我在搜索字段中输入文本时,搜索结果显示正常,但由于结果表格的背景是透明的,我看到我的tableview
并在tableview
显示搜索结果表。我想隐藏tableView
当 searchField 开始编辑时。我努力了
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString
{
[tableView setHidden:YES];
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}
但它隐藏了 tableView 的搜索栏。如何修复它?
首先我知道你添加searchDisplayController
on UITableView
.
请删除它并添加您的UISearchDisplayController
在你的视图控制器 not on UITableView
,因为如果你隐藏UITableView
then UISearchDisplayController
也隐藏,因为您添加了 UISearchDisplayControllerUITableView
.
谢谢 :)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)