Reputation: 5683
Using XCode 4.1 I've come across a crash whenever I try to use a CollectionView.
These are the steps I'm doing:
Does this happen for anyone else or is it just something I'm coming across? Is there a way to work around it to allow me to bind to the Collection View Item (I want ultimately to bind to the representedObject value) either in XCode or in code.
I attempted to create a custom NSCollectionViewItem subclass that uses a separate nib file and set that as the itemPrototype of the NSCollectionView but things went very wrong then.
Upvotes: 3
Views: 2181
Reputation: 1476
I've found a temporary work around:
Select the "Collection View Item" and under the "Attributes Inspector" → "View Controller" settings, set "Nib Name" to "MainMenu".
Once you've done this, it won't crash, and you can set the bindings. Be sure to clear the "Nib Name" setting when building your app.
Upvotes: 1
Reputation: 7465
I found that splitting the collection view item view into its own XIB and then rewiring the connections so that the collection view item prototype loads the new XIB will allow for you to create the bindings in interface builder without it crashing. I followed these steps...
I'm not sure that it's quicker than doing it programmatically, but it does allow you to manage the bindings without writing code. I've got a few apps working this way now.
Upvotes: 6
Reputation: 2925
Yup, I can confirm this bug too, even on Interface Builder 3.
The only workaround is to do the binding programmatically:
[textField bind:@"value" toObject:collectionViewItem withKeyPath:@"representedObject.foo" options:nil];
Upvotes: 0