What I have done, and works, is to use a CPArrayController. Example:
var myCollectionView = [[CPCollectionView alloc]
initWithFrame:CGRectMake(0.0, 0.0, 500.0,500.0)];
[myCollectionView setAutoresizingMask: CPViewWidthSizable |
CPViewHeightSizable];
var cViewItem = [[CPCollectionViewItem alloc] init];
[cViewItem setView:[[ListView alloc] initWithFrame:CGRectMake(0,
0, 200, 200)]] ;
[myCollectionView setItemPrototype:searchResultItem];
[myCollectionView setDelegate: self]; // for handling selections
[myCollectionView setVerticalMargin: 0.0]; // spacing.
[myCollectionView setMinItemSize:CGSizeMake(10.0, 20.0)]; // to
keep it from getting too small
[myCollectionView setMaxItemSize:CGSizeMake(1000.0, 45.0)]; // to
keep it real
[myCollectionView setMaxNumberOfColumns:1]; //setting a single
column will make this appear as a vertical list
_listOfItems = [CPArray array];
arrayController = [[CPArrayController alloc] init];
[arrayController setEditable:YES];
[arrayController setObjectClass:ListItem]; // Declare what the
array holds.
[arrayController setAutomaticallyPreparesContent:YES];
[arrayController setSelectsInsertedObjects:YES];
[arrayController setAvoidsEmptySelection:YES];
[arrayController bind:@"contentArray" toObject:self
withKeyPath:@"_listOfItems" options:nil]; // Bind the array
controller's content array to our _listOFItems array.
[myCollectionView bind:@"content" toObject:arrayController
withKeyPath:@"arrangedObjects" options:nil]; // Bind collection view's
content array to the array controller's arrangedObjects
Then to add items, add them to the array controller. They will then
appear in both the collection view, and the _listOfItems array.
[arrayController addObject:newListItemObject];
Hope this helps... It took me a while to figure this out myself... But
I'm also with a handicap of not knowing Objective-C/J or Coco very
well...
The Bindings objects are mostly in the bindings GIT branch, so, in my
experience, you might need to checkout that branch.