: didLoadSearchResultsTableView: – searchDisplayController: willUnloadSearchResultsTableView: 3).显示和隐藏 tableview事件处理方法: – searchDisplayController:willShowSearchResultsTableView: – searchDisplayController: didShowSearchResultsTableView: – searchDisplayController:willHideSearchResultsTableView: – searchDisplayController :didHideSearchResultsTableView: 4).搜索条件改变时响应事件处理方法: – searchDisplayController:shouldReloadTableForSearchString return YES; } - (BOOL) searchDisplayController: (UISearchDisplayController *)controller shouldReloadTableForSearchScope
tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (tableView == self.searchDisplayController.searchResultsTableView UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:flag]; } if (tableView==self.searchDisplayController.searchResultsTableView searchBarShouldEndEditing:(UISearchBar *)searchBar{ NSLog(@"搜索End"); return YES;} 搜索时过滤数据: - (BOOL)searchDisplayController UISearchController实现搜索 UISeachBar通过UISearchDisplayDelegate实现上面的效果是没有问题的,网上也有很多类似的实现效果,不过是警告的,信息如下: 'searchDisplayController
toolbarItems: 工具栏子项集 • tabBarItem: 标签栏子项 • editButtonItem:返回一个编辑按钮 • parentViewController:交视图控制器 • searchDisplayController