I have an NSTableView which I wish to allow users to drag-and-drop video files onto. When they drop the file, it'll get added as a row in the table view.

How would I go about doing this? Currently the tableview's takes its data from an Array Controller (which takes its data from a NSMutableArray)

I found this documentation, but cannot seem to make it work..

I have..

  • made a "TableCon" class (which I changed to inherit from NSTableView, not NSObject)
  • changed the NSTableView class to TableCon
  • set the NSTableView's delegate outlet to that class
  • called registerForDraggedTypes in TableCon's init
  • implemented - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender; (again in TableCon)

..but, nothing, it acts like I never changed anything (no errors), what am I doing wrong?

Edit: I've tried implementing Boaz Stuller's suggestion, and also found this description of the solution (the first reply includes the solution to the first post). So what I have done now is..

  • Subclass NSArrayController which feeds content to the table view (TableListCon)
  • Add tableView outlet to TableListCon (and pointed it at the NSTableView)
  • Implement validateDrop, writeRowsWithIndexes, and acceptDrop in TableListCon
  • Called registerForDraggedTypes on the tableView outlet.

Again, no errors/warnings, but only the awakeFromNib method seems to be called (None of the other methods are called)

Edit
Report