Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
- // Update the filtered array based on the search text and scope.
- // Remove all objects from the filtered search array
- [self.filterEarningcallArray removeAllObjects];
- [self.latestEarningcallstable reloadData];
- // Filter the array using NSPredicate
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY SELF CONTAINS %@", searchText];
- filterEarningcallArray = [NSMutableArray arrayWithArray:[companyNameArray filteredArrayUsingPredicate:predicate]];
- NSLog(@"searched array is %@",filterEarningcallArray);
- }
- #pragma mark - UISearchDisplayController Delegate Methods
- -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
- // Tells the table data source to reload when text changes
- [self filterContentForSearchText:searchString scope:
- [[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
- // Return YES to cause the search result table view to be reloaded.
- NSLog(@"fired delegate in scopewd");
- return YES;
- }
Advertisement
Add Comment
Please, Sign In to add comment