SearchBarをプログラムしましたが、検索をtableViewにドラッグするb<インターフェイスビルダーにotがありません。SearchResultは他のTabelViewに表示されました。検索はうまくいきます。しかし、検索するたびに、このSearchResultポップオーバーが表示されます。このポップオーバーを削除できますか?
[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;
ありがとう