I have the following UITableViewController + UISearchBar setup
@interface FeedTableView : UITableViewController <UISearchBarDelegate,UISearchDisplayDelegate>
{
NSMutableArray *ArrayDatiOriginali;
NSMutableArray *searchData;
UISearchBar *searchBar;
UISearchDisplayController *searchDisplayController;
}
Below the load method
- (void)viewDidLoad
{
[super viewDidLoad];
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
searchDisplayController.searchResultsDelegate=self;
self.tableView.tableHeaderView = searchBar; tableView.
}
To select data/rows when the UISeach appear i use
if(tableView==self.searchDisplayController.searchResultsTableView)
{
NSLog(@"Riga corrente: %i",indexPath.row);
appo=[searchData objectAtIndex:indexPath.row];
}
and it works ok for filtering table view.
But if:
- Search view is active (showing filtered result)
- I click on a row of the filtered result
Then
didSelectRowAtIndexPathis fired butin the
cellForRowAtIndexPathmethod the expressionif(tableView==self.searchDisplayController.searchResultsTableView) return FALSE
also if UISearchView is active
Any ideas?
FALSEfromcellForRowAtIndexPath? I don't really follow what the problem is - the selection works but after selection the display doesn't? - Wain