SHOW:
|
|
- or go back to the newest paste.
1 | -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { | |
2 | if (searchText.length == 0) { | |
3 | isFiltered = NO; | |
4 | } | |
5 | else { | |
6 | isFiltered = YES; | |
7 | - | |
7 | + | |
8 | for (NSDictionary *dict in catalog) | |
9 | { | |
10 | NSArray *elements = [dict objectForKey: @"categoriesList"]; | |
11 | for (NSDictionary *element in elements) | |
12 | if ([element[@"title"] compare:searchText options:NSCaseInsensitiveSearch range:NSMakeRange(0, [searchText length])] == NSOrderedSame) | |
13 | - | [catalog addObject: element]; |
13 | + | [filtered addObject: element]; |
14 | ||
15 | } | |
16 | [table reloadData]; | |
17 | } |