0

我正在表格视图中实现搜索栏,但搜索后我的地址从实际地址更改,我现在该怎么办

-(void)searchBar:(UISearchBar*)searchBar textDidChange:(NSString*)text
{

    if(text.length == 0)
    {
        isFiltered = FALSE;
    }
    else
    {
        isFiltered = true;
        filteredListResults = [[NSMutableArray alloc] init];
        GWTG *gwtg ;
        for (gwtg in listResults)
        {
            NSRange nameRange = [gwtg.celebrity_name rangeOfString:text options:NSCaseInsensitiveSearch];//NSCaseInsensitiveSearch
            NSRange descriptionRange = [gwtg.location_name rangeOfString:text options:NSCaseInsensitiveSearch];
            if(nameRange.location != NSNotFound || descriptionRange.location != NSNotFound)
            {
                [filteredListResults addObject:gwtg];
            }
        }
    }

    [tblSearch reloadData];
}
4

0 回答 0