【发布时间】:2011-06-29 22:07:07
【问题描述】:
所以我有一个详细视图,需要通过从 self.tableview 中选定单元格的 indexpath 中获取一个索引整数来显示信息,我也一直在将 NSFetchedResultsController 用于 self.tableview。我还实现了一个 UISearchDisplayController 来进行搜索。
问题: 如何将 UISearchDisplayController tableview 中选择的 indexPath 转换为原始 self.tableview 的 indexpath?还是我需要设置一个 NSArray 实例并循环遍历它以找出索引?最有效的方法是什么?
代码如下:
-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
NSLog(@"display project details");
if (tableView == self.table) {
[parentController projectSelectedFromList:indexPath.row];
}else{
NSInteger index;
//what to put here? To get the indexPath of the self.table from search tableview
[parentController projectSelectedFromList:index];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
【问题讨论】:
标签: iphone objective-c cocoa-touch uitableview