I'm trying to filter the 4 arrays but I can not work it, it's a pushed tableview Uses NSSSING. When I write something in the search bar, the search results are in the other than the 1 arrow (merlance). I know that the problem is in - (zero) filtertContentForSearchText:
. I missing
- (NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section {if (tableView == self.searchDisplayController.searchResultsTableView) {return [self. SearchResults2] count; } Else {if ([testName isEqualToString: @ "CES"]) Return [self.CES count]; If ([testName isEqualToString: @ "Merlin"]) back [self. Marlin count]; If ([testName isEqualToString: @ "DELTA 2, Navigator"]) Return [Self. Delta count]; If ([testName isEqualToString: @ "CREW 2002, Navigator"]) back [self. CREW calculation]; } Return 0; } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * CellIdentifire = @ "cell"; UITableViewCell * cell = [TableView deView Re-Eligible CellWithIdentifier: CellIdentifire]; If (cell == zero) {cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifire]; } If (tableView == self.searchDisplayController.searchResultsTableView) {cell.textLabel.text = [self.searchResults2 objectAtIndex: indexPath.row]; } Else {if ([testName isEqualToString: @ "CES"]) {cell.textLabel.text = [self.CES Objektatindeks: indexPath.row]; } Else if ([testName isqualToString: @ "marlin"]) {cell.textLabel.text = [self. Marling ObjectAutandx: IndexPath.ro]; } Else if ([testName isEqualToString: @ "Delta 2, Navigator"]) {cell.textLabel.text = [self.DELTA objectAtIndex: indexPath.row]; } Else if ([testName isEqualToString: @ "Crew 2002 Navigator"]) {cell.textLabel.text = [self.CREW objectAtIndex: indexPath.row]; }} Return Cell; } #pragma Search Methods - (zero) filtertContentForSearchText: (NSString *) Search text field: {NSPrite * Self.searchResults2 = [Self. Marlin filtered estimation using the application: predicate]; Self.searchResults2 = [self.CES is filtered using the phrase Valid: predicate]; Self.searchResults2 = [Self. Using Crew Filtered Array Valid: Count]; Self.searchResults2 = [self. Using DELTA filtered accessories is valid: Speak]; } - (BOOL) searchDisplayController: (UISearchDisplayController *) Administrator should be ReloadTableForSearchString: (NSString *) Search String {[self filtertContentForSearchText: searchString area: [[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex: [self.searchDisplayController.searchBarSuggestedStyleButton Industries]] ]; Yes come back } @end
(By removing comments from one 'answer', together Better):
You have a scope parameter that you are not using inside the filter method to be reloaded in some usefulTemplateThereforeststring: To know which array you want to filter.
Look at that scope variable if its current value is something that you want to use, to find out which array you want to use, at the minimum, you can copy your copy You can ... and block you like the code in the cellphone indexpath and filter only a special array. / P>
No comments:
Post a Comment