Note that there are some explanatory texts on larger screens.

plurals
  1. POMy Search Bar Is Not Working
    primarykey
    data
    text
    <p>I want to make a search bar. Is there anything wrong with this code?</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; PFQuery *query = [PFUser query]; [query orderByAscending:@"username"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (error) { NSLog(@"Error %@, %@", error, [error userInfo]); } else { self.allUsers = objects; [self.tableView reloadData]; } }]; self.searchedUsers = [NSMutableArray arrayWithCapacity:[self.allUsers count]]; self.searchUsers = [[UISearchBar alloc]init]; self.doSearch = [[UISearchDisplayController alloc]initWithSearchBar:self.searchUsers contentsController:self]; self.doSearch.delegate = self; self.doSearch.searchResultsDataSource = self; self.doSearch.searchResultsDelegate = self; } - (void) fileterContentForSearchText:(NSString *)searchText { [self.searchedUsers removeAllObjects]; for (NSDictionary *item in self.allUsers) { NSComparisonResult result = [[item objectForKey:@"name"] compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])]; if (result == NSOrderedSame) { [searchedUsers addObject:item]; } } } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString]; return YES; } </code></pre> <p>Can someone please fix this code? I have followed tons of tutorials and none of them have worked. I would really appreciate it. Thank you!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload