I have an NSArrayController on which I apply a filter Predicate programatically:
- (void)setFilters {
NSPredicate *pred = [NSPredicate predicateWithBlock:^BOOL(LMRootItem *rootItem,
NSDictionary *bindings) {
...
return YES;
}];
[_controller setFilterPredicate:pred];
}
When the NSArrayController's content bindings are set up using IB everything works correctly.
When I set up NSArrayController's content bindings programmatically then my filter predicate function is never called and the contents are never filtered:
[_controller bind:@"arrangedObjects"
toObject:_otherController
withKeyPath:@"arrangedObjects.@unionOfArrays.rootItems"
options:nil];
The binding is identical to the one that I do in IB.
Does anyone have any idea what's going wrong?
Found it. It seems that I should have done this:
[_controller bind:@"contentArray"
toObject:_otherController
withKeyPath:@"arrangedObjects.@unionOfArrays.rootItems"
options:nil]