KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to create a simple NSView that will allow a folder from Finder to be dragged onto it. A folder path is the only thing I want the view to accept as a draggable item. I've been trying to follow the Apple documentation , but so far nothing's working. So far, I've just tried to get the view to work with any file type, but I can't even seem to do that. Here's what I have so far: -(id) initWithFrame:(NSRect)frameRect { if (self = [super initWithFrame:frameRect]) { NSLog(@"getting called"); [self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeString, NSPasteboardTypePDF, NSPasteboardTypeTIFF, NSPasteboardTypePNG, NSPasteboardTypeRTF, NSPasteboardTypeRTFD, NSPasteboardTypeHTML, NSPasteboardTypeTabularText, NSPasteboardTypeFont, NSPasteboardTypeRuler, NSPasteboardTypeColor, NSPasteboardTypeSound, NSPasteboardTypeMultipleTextSelection, NSPasteboardTypeFindPanelSearchOptions, nil]]; } return self; } -(BOOL) prepareForDragOperation: (id<NSDraggingInfo>) sender { NSLog(@"preparing for drag"); return YES; } The initWithFrame: method is getting called, but when I try to drag into the view the prepareForDragOperation: method doesn't ever seem to get called. My questions:<
Tags (comma-separated)
Save Edits
Cancel