Overriding NSCollectionView's selection: a good idea?
Overriding NSCollectionView's selection: a good idea?
- Subject: Overriding NSCollectionView's selection: a good idea?
- From: Andrew McClain <email@hidden>
- Date: Mon, 17 Aug 2009 15:10:31 -0700
I've been reading docs and looking at IconCollection for the last week and I
still can't really figure this out.
Here's the behavior I want to model: pretend I'm making poker dice game (I'm
using this as an example to help me understand cocoa programming). I have a
visual representation of the dice, and I want to select a certain number of
them each round.
Right now I'm using NSCollectionView with a prototype view that has a text
field (for a representation of the dice) and a button (for toggling
selection). Eventually I'll just use an image representation, but I'm just
trying to get this to work now.
When the user clicks the button in a view, the corresponding die will be
added into a "diceinhand" array in my AppController.
I can't figure out how, though, to connect the button in a way that
allows the AppController to understand which die has been selected
-- that is, I can't find any way to pass the representedObject associated
with my replicated view to any controller (but perhaps I'm thinking about
that incorrectly).
1. Can I call a selector on the representedObject itself from the view?
Where would I set that up that programmatically (I'm assuming you can't do
that with IB)?
or
2. Is it better to abandon the "selection buttons" and use the selection
code of NSCollectionView? Does that mean the user needs to shift-click to
select multiple dice? Since all I'm doing is trying to is add the object to
another array in my AppController, couldn't I programmatically bind the
DiceInHand array in my AppController to the selectedObjects key of my array
controller or do I need another array controller to manage that?
I'm happy to read docs, it just seems that everything I've been reading
deals mostly with binding values in a prototype view.
Thank you,
Andrew
_______________________________________________
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