2012-04-16 33 views
0

我在做什麼錯?UISearchDisplayController tableView不會觸發prepareForSegue

我有2個tableViewControllers。其中一個工作正常。當我進行搜索時,結果顯示右邊的附件按鈕,並且prepareForSegue運行良好。

但另一個tableViewController與第一個完全相同。搜索工作正常,但不顯示附件按鈕,並且prepareForSegue未被解僱。

找不到遺漏的東西。

回答

0

我不喜歡這樣的解決方法:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (tableView == self.searchDisplayController.searchResultsTableView) { 
     [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
     [self performSegueWithIdentifier:@"ShowComment" sender:self]; 
    } 
} 

我還是不爲什麼prepareForSeque不火searchDisplay的tableview得到它。

0

我花了一些時間看這個。我有完全相同的問題,並且我沒有爲這個特定的構建使用故事板,因爲我以編程方式將搜索添加到導航欄。這一切都歸結爲一個簡單的事情,補充一點:

[searchDisplayController setSearchResultsDelegate:自我]

一旦我做到了,那麼didSelectRowAtIndexPath方法最終焙燒從我的SearchResult所的tableView選擇的結果!