- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
// Update the filtered array based on the search text and scope.
[self.filteredListContent removeAllObjects]; // First clear the filtered array.
//mode==1 means search mode. mode==0 means normal mode.
if (![searchText isEqualToString:@""]) {
mode=1;
}
for (id arrayObject in listContent)
{
NSString *objectInfo=[arrayObject getDescription];
NSRange result=[objectInfo rangeOfString:searchText options:NSCaseInsensitiveSearch];
if (result.location >= 0 && result.location<=[objectInfo length])
{
[self.filteredListContent addObject:arrayObject];
}
}
}
이미이 질문은 언젠가 다시 요구했다 - http://stackoverflow.com/questions/10510131/search-bar-in-xcode-iphone – rishi