【发布时间】:2013-08-28 18:52:49
【问题描述】:
我有一个UIViewController,里面有一个UISearchDisplayController。我让它显示搜索结果表格视图,但单击任何单元格都不会触发didSelectRowAtIndexPath:
#pragma mark - UITableViewDelegate
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"did select row");
}
我看过这些相关的问题:
- Why won't my UISearchDisplayController fire the didSelectRowAtIndexPath method?
- didSelectRowAtIndexPath does not work when uitableview datasource is filtered
但我没有犯同样的错误。视图控制器实现了UITableViewDelegate 和UISearchDisplayDelegate。 UISearchDisplayController 委托和 searchResultDelegate 连接到情节提要中的视图控制器。但为了确保我在viewDidLoad 中做了以下操作:
self.searchDisplayController.searchResultsDelegate = self;
self.searchDisplayController.delegate = self;
我什至尝试过:
self.searchDisplayController.searchResultsTableView.delegate = self;
searchResultsTableView 是此视图控制器中唯一的UITableView。
【问题讨论】:
标签: ios objective-c uitableview uisearchdisplaycontroller