Search code examples
objective-cfilternspredicatensarraycontroller

Problem filtering NSArrayController


I have problem filtering an NSArrayController. Content Array is bound to an NSMutableArray holding NSDictionaries. I want to filter all NSDictionaries whose "name" key equals "a". I run these two lines when my app launches but nothing gets filtered.

NSPredicate *filter = [NSPredicate predicateWithFormat: @"name like %@", @"a"];

[arrayController setFilterPredicate: filter];

Solution

  • NSPredicate *filter = [NSPredicate predicateWithFormat: @"name=%@", @"a"];
    
    [arrayController setFilterPredicate: filter];