• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
indexOfObjectIdenticalTo: problem with NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: indexOfObjectIdenticalTo: problem with NSArrayController
      • From: Ashley Clark <email@hidden>
  • Prev by Date: Re: NSArrays and tableView delegates
  • Next by Date: Re: Big picture relationships between NSConnection, NSInputStream, NSOutputStream etc
  • Previous by thread: Re: NSArrays and tableView delegates
  • Next by thread: Re: indexOfObjectIdenticalTo: problem with NSArrayController
  • Index(es):
    • Date
    • Thread