0

我有它,所以当用户输入 UISearchBar 时,它会像这样过滤结果:

#pragma mark - UISearchResultsUpdating

-(void)updateSearchResultsForSearchController:(UISearchController *)searchController {
    NSString *searchString = [self.searchController.searchBar text];
    [self updateFilteredContentForSaleName:searchString];
    [((UITableViewController *)self.searchController.searchResultsController).tableView reloadData];
}

#pragma mark - Content Filtering
- (void)updateFilteredContentForSaleName:(NSString *)wordName {
    [self.searchResults removeAllObjects];

    for (PFObject *word in parseWords)
    {
        NSString *aWord = [word objectForKey:@"word"];
        if ([[aWord lowercaseString] containsString:[wordName lowercaseString]])
        {
            [self.searchResults addObject:word];
        }
    }
}

问题是当输入诸如“谎言”或任何 3 个字符(或更少)的单词时,不会显示 3 个字符或更少单词的结果。

知道为什么会这样吗?

4

0 回答 0