【发布时间】:2013-02-11 07:06:09
【问题描述】:
我有一个 UITableView 并实现了一个 searchDisplayController。我有
tableView.backgroundColor = [UIColor clearColor];
和
self.searchDisplayController.searchResultsTableview.backgroundColor = [UIColor clearColor];
当我在搜索字段中输入文本时,搜索结果显示正常,但是由于结果表的背景是透明的,我看到了我的tableview 并且在tableview 上显示了搜索结果表。我想在 searchField 开始编辑时隐藏tableView。我试过了
-(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隐藏了searchBar。如何解决?
【问题讨论】:
-
你在哪里添加 UISearchBar???在 UITableView 上???
-
是的,我拖了一个 UISearchDisplayController 并将搜索栏添加到 tableView
-
非常感谢,它成功了。
标签: iphone ios objective-c xcode xcode4.2