Tutorial: Drag and Drop file on NSImageView
Categories: Mac OS X, Tutorials on Feb.26, 2010
Step by step for starter developers…
1. Create a project in xCode with name “DragAndDrop” or any else…
2. Add an element “NSImageView” on main view in the MainMenu.xib
3. Add files NSCImageView.m/NSCImageView.h to project with subclass of UIView
4. Replace “NSImageView” name class on “NSCImageView” in the NSImageView objec
5. Change subclass “NSView” to “NSImageView” 
6. Remove all methods from *.m file

7. Methods for getting entering and exit of dragging

8. Method for checking information of dragging result

Note: If you make drag and drop with NSView and any other object, you will need add this code:
1 2 | [self registerForDraggedTypes:[NSArray arrayWithObjects:NSTIFFPboardType, NSFilenamesPboardType, nil]]; |
Result:
Similar posts:



Оставить отзыв