Re: NSArrayController for unordered collection (a Set)
Re: NSArrayController for unordered collection (a Set)
- Subject: Re: NSArrayController for unordered collection (a Set)
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 4 Jan 2005 10:42:04 -0800
On Jan 4, 2005, at 4:42 AM, Bob Peterson wrote:
I'm still stuck trying to come up with a way to design a mutable
property that is a mathematical set, not an ordered array. Key-Value
Coding and Binding seems geared to ordered model arrays.
I think I would say that the only current collection controller object
is designed to work with arrays, not that Key-Value Coding and Bindings
in general are designed that way...
The available methods all assume there is an index to insert at or get
from. I can ignore the index in my implementation of the
-insertObject:in<KEY>AtIndex: method. But there's no sensible way to
fake -objectIn<Key>AtIndex:. I can artificially define an ordering
and maintain a indexing array (or dispense with the set altogether),
but this seems a silly thing to force on my models simply to suit
NSControllers.
Perhaps I misunderstood your original request?
I have a fixed-order collection of items for the user to see and
edit. The user cannot change the order of items, but
NSArrayController seems to be designed for just this.
Where have you defined this fixed order? It should be the case that in
your controller you can use -objectIn<Key>AtIndex: to retrieve the
correct object from your set based on this order, without needing to
modify the model objects? Or, to try a different tack, how would you
implement the table view datasource methods if you weren't using
bindings?
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden