NSArrayController indices and Drag & Drop
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