Search code examples
iphoneiosxcodeuisearchbaraqgridview

How to Filter Cells in AQGridView with UISearchBar


i'm going crazy on this problem: I'm using AQGridView for show some image from an array that i retrieve from SQLite but i'm not able to filter the Grid with a UISearchBar that i put in the TitleView of a Detail zone in a SplitViewController. Can u help me with some logic passage or with an example?

Thanks!


Solution

  • SOLVED!

    Recalculated the array _icons after removed all objects..

        [_icons removeAllObjects];
    
        searching = YES;
    
    
        NSInteger numeroElem = [subcatList getSize];
    
    
        for ( NSUInteger i = 0; i < numeroElem; i++ )
        {
    
        NSDictionary *itemAtIndex = (NSDictionary *)[subcatList objectAtIndex:i];
        NSString *titolo_cat = [itemAtIndex objectForKey:@"titolo"];
    
        NSComparisonResult result = [titolo_cat compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
        if (result == NSOrderedSame)
        {
         ETC ETC.......
         [_icons addObject: image];
        }
    
        };