• 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
NSArrayController indices and Drag & Drop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController indices and Drag & Drop


  • Subject: NSArrayController indices and Drag & Drop
  • From: "Matthew M. Swann" <email@hidden>
  • Date: Sat, 28 May 2005 19:30:30 -0700

Hi all,

I've got a quick question about drag and drop support for table views that are bound to an array controller. Before cocoa bindings, I always knew what object was at what row in my view, and thus operations like tableView:acceptDrop:row:dropOperation: were easy to implement (since my action depends on the row index returned from the drag operation).

With an array controller, how do I make use of the row index? From previous posts, it doesn't appear to be possible to get the object that corresponds to an index without subclassing NSArrayController and writing a caching mechanism that keeps track of sorting, etc.

I discovered that a less-than-elegant way of getting the object at the index returned by the acceptDrop delegate method is to call setSelectionIndex: on the array controller, then call selectedObjects: and cast the 0th object in the returned array to my expected NSManagedObject. Is this the preferred solution?

Thanks!

Matt

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: NSArrayController indices and Drag & Drop
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: simple sprite engine (beta)
  • Next by Date: Re: NSArrayController indices and Drag & Drop
  • Previous by thread: simple sprite engine (beta)
  • Next by thread: Re: NSArrayController indices and Drag & Drop
  • Index(es):
    • Date
    • Thread