不确定如何启动此线程,因为我以前从未见过这种情况?
正在加载...
搜索前...
搜索后...
我有一个带有自定义加载警报的 TableView,当我添加一个 SearchBar 时,自定义加载警报显示来自 TableView 的行,以前有没有人见过这个,关于如何修复的任何想法?
多谢你们。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.searchDisplayController.searchResultsTableView)
{
return [self.searchResults count];
}
else
{
return [self.itemsToDisplay count]; }
}
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
[self.searchResults removeAllObjects];
for (MWFeedItem* item in itemsToDisplay) {
NSComparisonResult result = [[item.title stringByConvertingHTMLToPlainText] compare:searchText
options: (NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch)
range:NSMakeRange(0, [searchText length])];
if (result == NSOrderedSame) {
[self.searchResults addObject:item];
}
}
}
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}