objective c - Drag-and-drop files onto an NSTableView? -
I have a NSTableView that I allow video files to drag and drop users Want to give When they leave the file, it will be added as a line in the table view.
How would I go about doing this? Currently TableView data is from an array controller (which takes its data from NSMUTABELRAR)
I have got a documentation, but it can not seem to work.
< P> I have made ... registerForDraggedTypes in TableCon's init - draggingEntered: (ID of & lt; NSDraggingInfo & gt;) This (again In tablecon) .. But, nothing, it seems like I did not change anything (no error), what am I doing wrong?
Edit: I have tried to implement Boaz Stoller's suggestion, and also found the details of the solution (including the solution for the post), so now what I did
- Subclass NSArrayController that feeds content in table view (TableListCon)
- Add
tableviewoutlet to TableListCon (and it's in the direction of NSTableView - Apply validateDrop, writeRowsWithIndexes, and acceptDrop in TableListCon
- On the tableView Outlet is called registerForDraggedTypes.
Once again, there are no errors / warnings, but only the awake framenb method is being called (no other method is called)
NSTableView handles different drag-and-drop from generic views, which means it's a good thing overall. You do not need to manually handle complex highlighting, cell tracking and inserting the requirements of tables that
details of what is required can be found. Basically, you still call -registerDraggedTypes: (generally in your -awakeFromNib method), but instead of applying NSDraggingDestination methods, you can be found in different data sources, associated with drag and drop, applied. You do not need NSTableView subclass to apply drag-and-drop in this fashion.
Note that these are data source methods that you need to hook up the table view data to apply the source outlet to that category that those methods are called for them.
Comments
Post a Comment