Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. copyLists = [[NSMutableArray alloc] initWithArray:sortedList copyItems:YES];
  2.  
  3. - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
  4. {
  5. [self.filteredList removeAllObjects]; // First clear the filtered array.
  6.  
  7. NSArray *objcts = unfilteredList;
  8.  
  9. for (NSDictionary *section in objcts)
  10. {
  11. for (NSDictionary *row in [section valueForKey:@"Rows"])
  12. {
  13. NSRange rng = [[row valueForKey:@"name"] rangeOfString:searchString options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)];
  14.  
  15. if (rng.length != 0)
  16. [self.filteredList addObject:row];
  17. }
  18. }
  19. // Return YES to cause the search result table view to be reloaded.
  20. return YES;
  21. }
  22.  
  23. NSArray *rows;
  24. if (tableView == self.searchDisplayController.searchResultsTableView)
  25. {
  26. rows = filteredList;
  27. } else {
  28. NSDictionary *section = [unfilteredList objectAtIndex:indexPath.section];
  29. rows = [section objectForKey:@"Rows"];
  30. }
  31. cell.textLabel.text = [[rows objectAtIndex:indexPath.row] objectForKey:@"name"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement