I have a NSCollectionView based master-detail interface, where I want to display Boards in the master and Lists+Cards in the detail view.
Board
, holds a
If each list
is the representedObject
for each view item in the collection view, then you can populate each popupButton with a readonly
NSArray property dependent upon the cards
array that is in each list
. In the List
class add arrangedCards as a property.
- (NSArray *)arrangedCards
{
return [[self valueForKey:@"cards"] sortedArrayUsingDescriptors:
[self arrangedCardsSortDescriptors]];
}
Use the sort you want for the popup. This arranges by name
.
- (NSArray *)arrangedCardsSortDescriptors
{
NSSortDescriptor *sortByName = [[NSSortDescriptor alloc] initWithKey:
@"name" ascending:YES];
return @[sortByName];
}
Bind the Content of the popup to the NSCollectionViewItem.
Model Key Path is representedObject.arrangedCards
.
Use representedObject.arrangedCards.name
as the Content Values.