I am using UISearchDisplayController based on this tutorial: http://developer.apple.com/library/ios/#samplecode/TableSearch/Introduction/Intro.html
I have a table view in a navigation controller with this search controller. As usual, you can perform a search, click on the search result and go to the detailed view.
I am using code like the one below to determine if the current table view is a search of ResultsTableView.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if(tableView == self.searchDisplayController.searchResultsTableView) return 1; else return [self.arrCharacters count]; }
My problem is when the user returns from the detailed view to the search result table view, that the tableView becomes a regular table view and not a ResultTableView search. But the table is still filtered and only displays search results. Just tableView is no longer recognized as searchResultsTableView. So all my index calculations go wrong and the application crashes.
Any help is greatly appreciated.
Many thanks,
- , TableView tableView. , , , - . searchDisplayController,
-(void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller
, , . , if tableView , . , , ( ) , tableView - searchResultTableView.