UITableView Search
Posted
by lkl
on Stack Overflow
See other posts from Stack Overflow
or by lkl
Published on 2010-04-28T10:00:12Z
Indexed on
2010/04/28
10:03 UTC
Read the original article
Hit count: 398
Hi all,
I'm using the following code for my search on my table:
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
[searchParent removeAllObjects];
for(NSString *a in parent)
{
NSComparisonResult result = [a compare:searchText options:(NSCaseInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
if(result == NSOrderedSame){
[searchParent addObject:a];
}
}
}
It's working fine, however, only for one character.
I get the following in the console:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'
Any help is appreciated greatly!
Thanks
© Stack Overflow or respective owner