我在界面构建器中编写了一个 SearchBar,但没有将搜索拖到 tableView。SearchResult 显示在另一个 TabelView 中。搜索效果很好。但是每次我搜索时,它都会向我显示这个 SearchResult Popover。我可以删除此弹出框吗?
[SetShowsSearchResultsButton self.searchDisplayController.searchBar: NO];
它也不起作用
这是一些代码
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[appDelegate.searchSource removeAllObjects];
if (0 == [searchString length]) {
NSLog(@"LEER");
appDelegate.gefunden=NO;
[appDelegate.rootViewController.tableView.tableView reloadData];
[SearchBar1 resignFirstResponder];
}
for (NSArray *myPoi in appDelegate.poiList)
{
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF contains[c] %@)", searchString];
BOOL resultName = [predicate evaluateWithObject:[myPoi valueForKey:@"name"]];
if (resultName) {
appDelegate.gefunden = YES;
[appDelegate.searchSource addObject:myPoi];
[appDelegate.rootViewController.tableView.tableView reloadData];
[self.searchDisplayController setActive:NO animated:YES];
[self.SearchBar1 becomeFirstResponder];
}
}
return YES;
}
并在 viewdidload
self.searchDisplayController.searchResultsDataSource = appDelegate.rootViewController.tableView.tableView.dataSource;
谢谢