gpt4 book ai didi

iOS:全文搜索

转载 作者:行者123 更新时间:2023-11-29 13:25:20 26 4
gpt4 key购买 nike

我的应用程序在用户将搜索结果输入 UISearchBar 后立即解析搜索结果。一切正常。但现在我想搜索全文。结果在我的 NSMutableArray 中,但没有显示。我认为问题是这段代码:

NSRange nameRange = [SDPE.title rangeOfString:self.searchBar.text options:NSCaseInsensitiveSearch];

我能做什么?

最佳答案

检查这个:

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
searchBar.showsCancelButton = YES;
if([self.filteredListContent count]>0)
{
[self.filteredListContent removeAllObjects]; // First clear the filtered array.
}

for (int cnt = 0; cnt< [self.listContent count];cnt++)
{
NSRange range = [[[self.listContent objectAtIndex:cnt]lowercaseString] rangeOfString :[searchText lowercaseString]];

if(range.length>0)
{
[self.filteredListContent addObject:[self.listContent objectAtIndex:cnt]];
}
self.blSearchBarClicked = TRUE;
[self.tbViewSearch reloadData];
}
}

关于iOS:全文搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13269167/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com