Ios 使用UISearchDisplayController时未发生选择

Ios 使用UISearchDisplayController时未发生选择,ios,uitableview,uisearchdisplaycontroller,Ios,Uitableview,Uisearchdisplaycontroller,我正在将UISeachDisplayController与UITableView一起使用。它是在UITableViewController的viewDidLoad方法中以编程方式设置的: - (void)viewDidLoad { [super viewDidLoad]; [self loadProjectsAndTitles]; searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44

我正在将UISeachDisplayController与UITableView一起使用。它是在UITableViewController的viewDidLoad方法中以编程方式设置的:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self loadProjectsAndTitles];
    searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 600, 44)];
    searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar
                                                                contentsController:self];
    searchDisplayController.delegate = self;
    searchDisplayController.searchResultsDataSource = self;
    searchDisplayController.searchResultsTableView.allowsSelection = TRUE;
    self.tableView.tableHeaderView = searchBar;
}

除了在使用UISearchBar时单击某一行外,一切都运行得非常正常,
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath方法没有被调用,尽管在不使用UISearch时调用得非常好。我的问题是,这是正常的行为,还是选择方法有效?如果它应该工作,有没有任何建议,为什么它可能不工作

我想你忘记设置了

searchDisplayController.searchResultsDelegate = self;
searchResultsDelegate
是显示搜索结果的表视图的委托,而
DidSelectRowatineXpath
是表视图委托方法之一