Re: NSCollectionView woes
Re: NSCollectionView woes
- Subject: Re: NSCollectionView woes
- From: Volker in Lists <email@hidden>
- Date: Fri, 21 Nov 2008 19:55:12 +0100
Hi Cem,
the CollectionView needs only to be pointed to the cars
ArrayController and uses a rather obfuscated way of binding each of
its subviews fields to the appropriate car entries. you will have to
bind your prototype view controls to
CollectionView.representedObjects."key". The CollectionView is aware
of the arrangedObjects - if bound to them - and automagically creates
as many views as needed from your view prototype. I recommend to take
a look at the available examples provided by Apple or read through
Cocoadevs page on NSCollectionView.
HTH,
Volker
Am 21.11.2008 um 19:47 schrieb Cem:
I'm slowly working my way through Aaron Hillegass' Cocoa Programming
for Mac OS X and just completed the CarLot program (Chapter 11 in
the 3rd edition). I decided to challenge myself and try to change
the interface to use NSCollectionView instead of the interface in
the book. In order to do this, I bound the NSCollectionView itself
to my NSArrayController (which is called Cars) with a keypath of
arrangedObjects.condition. I then created a new NSObjectController
(called 'A car'), set it to entity mode, and set the entity name to
Car (the same as what Cars has). I bound its Content Object to
Cars.selection. I then bound the GUI elements to the appropriate
keys in Car (such as car.selection.makeModel).
This, of course, didn't work. Since Car is bound to the
Cars.selection, whenever the selection changes, ALL views in my
NSCollectionView change at the same time. I then tried a number of
variants, none of which worked. What I want is for each subview in
my NSCollectionView to see the data relating to a different car, not
all reflect the same car. What am I doing wrong?
BTW, if anyone wants the current project/code, the whole thing is
about 32 KB tarballed, so I can email it anywhere anyone wants it.
Thanks,
Cem Karan
_______________________________________________
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
_______________________________________________
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