2012-09-23 62 views
0

我想在選擇searchBar時顯示searchResultsTableView。我曾經嘗試這樣做:當選擇搜索欄時顯示searchDisplayController.searchResultsTableView

- (void) searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { 
    [self.searchDisplayController.searchResultsTableView reloadData]; 
    [self.searchDisplayController setActive:YES animated:YES]; 
} 

這:

- (void) searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller { 
    [self.searchDisplayController setActive:YES animated:YES]; 
} 

無論是作品。在我的numberOfRowsInSection方法中,我確實在數組中有行,但searchResultsTableView在我開始鍵入之前不顯示。有什麼想法嗎?謝謝!

回答

0

嘗試將searchdisplaycontroller設置爲活躍在以下UISearchBarDelegate方法

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar;      
+0

還不行。直到我開始輸入時,搜索欄才顯示任何內容。 – Crystal

+0

你有沒有找到解決這個問題的方法? – drisse