title: NSTableView and drag and drop from Finder
body: <p>I'm trying to implement drag and drop from the Finder into an NSTableView of my app. The setup uses an <code>NSTableView</code>, an array controller which acts as a datasource using Cocoa bindings to a Core Data store.</p>
  
  <p>I did the following, basically following various blog posts I found on SO and other sites:</p>
  
  <p>In the <code>awakeFromNib</code> of my view controller I call:</p>
  
  <pre><code>[[self sourcesTableView] registerForDraggedTypes:[NSArray arrayWithObjects: NSPasteboardTypePNG, nil]];
  </code></pre>
  
  <p>I subclassed NSArrayController and added the following methods to my subclass (the reasoning for subclassing is that the array controller needs to be informed of the drop as it acts as the datasource of the table view):</p>
  
  <pre><code>- (BOOL) tableView: (NSTableView *) aTableView acceptDrop: (id &lt; NSDraggingInfo &gt;) info row: (NSInteger) row dropOperation: (NSTableViewDropOperation)operation
  </code></pre>
  
  <p>My implementation for the above currently only writes to the log and then returns a boolean YES.</p>
  
  <pre><code>- (NSDragOperation) tableView: (NSTableView *) aTableView validateDrop: (id &lt; NSDraggingInfo &gt;) info proposedRow: (NSInteger) row proposedDropOperation: (NSTableViewDropOperation) operation
  </code></pre>
  
  <p>In IB I have the array controller pointing to my custom NSArrayController subclass.</p>
  
  <p>Result: nothing. When I drag a PNG from the desktop onto my table view, nothing happens and the file happily bounces back to its origin. I must be doing something wrong but don't understand what. Where am I going wrong?</p>