Re: @distinctUnionOfArrays problem
Re: @distinctUnionOfArrays problem
- Subject: Re: @distinctUnionOfArrays problem
- From: Trygve Inda <email@hidden>
- Date: Sat, 13 Feb 2010 00:27:53 +0000
- Thread-topic: @distinctUnionOfArrays problem
> I am trying to get @distinctUnionOfArrays to work with bindings.
>
> I have a Master NSArrayController. This contains an array of
> NSMutableDictionary objects. Each Dictionary has three NSString keys/fields:
> Genre, Artist, Album.
>
> I set the content of the Master Controller to my NSMutableArray and all is
> well - the array shows up in an NSTableView.
>
> I then have a single-column TableView "Genre" I have Genre NSArrayController
> and I try to bind this array controller to the Master Controler with IB:
>
> Genre, bound to Master
>
> Controller key: arrangedObjects
> Model Key Path: @distinctUnionofArrays.Genre
>
As a follow-up, this works in code:
NSArray* allObjects =
[masterController valueForKeyPath:@"arrangedObjects.Genre"];
NSArray* uniqueObjects =
[[NSSet setWithArray:content] allObjects];
I have 10 records, but only 4 types of Genres and I end up with 4 objects as
expected in uniqueObjects. I just can't make it do the same thing with
bindings.
Ultimately, I am trying to build a filter ala iTunes for a large array of
NSMutableDictionary. I want to get a list of unique Genres and Albums, then
filter Albums based on the selection in Genres and filter the finalArray on
the selection in Albums as well.
Ideas?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden