Guest User

Untitled

a guest
Apr 29th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. -(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
  2. // Update the filtered array based on the search text and scope.
  3. // Remove all objects from the filtered search array
  4. [self.filterEarningcallArray removeAllObjects];
  5. [self.latestEarningcallstable reloadData];
  6.  
  7. // Filter the array using NSPredicate
  8. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF CONTAINS %@", searchText];
  9. filterEarningcallArray = [NSMutableArray arrayWithArray:[companyNameArray filteredArrayUsingPredicate:predicate]];
  10.  
  11. NSLog(@"searched array is %@",filterEarningcallArray);
  12.  
  13. }
  14.  
  15. #pragma mark - UISearchDisplayController Delegate Methods
  16. -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
  17. // Tells the table data source to reload when text changes
  18. [self filterContentForSearchText:searchString scope:
  19. [[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
  20. // Return YES to cause the search result table view to be reloaded.
  21.  
  22. NSLog(@"fired delegate in scopewd");
  23. return YES;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment