Guys, I'm just lerning Objective C and writing software for table where I drag mp3 files and want to access their metadata and display artist, genre and etc. So I have class for "drag and drop" and class for "access metadata". I think problem is I don't know how to initialize QTMovie for file I dropped from finder to table.
here is line of code:
movie开发者_如何转开发 = [QTMovie movieWithFile:@"/* so, what i should write here??*/" error:nil];
thanks, A.
Basically, your question is just "How do I get a file from drag-and-drop?" Once you know how to get the dropped file, you just pass it into your mystery string. The short answer is that you implement the NSDraggingDestination protocol and in your performDragOperation:
method, you ask the drag info object for its propertyListForType:NSFilenamesPboardType
.
There's a whole drag-and-drop guide on Apple's website that includes lots of detailed instructions and example code.
精彩评论