indexOfObjectIdenticalTo: problem with NSArrayController
indexOfObjectIdenticalTo: problem with NSArrayController
- Subject: indexOfObjectIdenticalTo: problem with NSArrayController
- From: Mikael Wämundson <email@hidden>
- Date: Fri, 5 Dec 2008 00:46:35 +0100
Hi all.
Since it is good programming to not access an array's content through
its controller when in the model I'm trying to find a way to get to
the same object selected in the user interface (i.e. the array
controller).
In my view I have the array content sorted by binding it to a sort
descriptor. Thus, the indices of the array and the content of the
array shown in the view differs.
Now, when a certain object is selected in the view I want to do
something to this object by accessing it through the original array.
My first, perhaps foolish, guess would be to use
indexOfObjectIdenticalTo: or indexOfObject: like this:
int indexOfObject = [theOriginalArray indexOfObjectIdenticalTo:
[theArrayController selection]];
but this does not work. Looking in the reference I see that
[theArrayController selection] will return a proxy object. Is this the
reason my code won't work?
How would you solve this?
/wamund
_______________________________________________
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