Developer Documentations doesn't provides fully describe of registerForDraggedTypes method. For example, i want that my app all开发者_开发问答ow access only "*.abc" files. How can i do this?
If you'd like to have files dragged onto your view, your should register for the NSFilenamesPboardType
type. If you want accept only certain filenames, you can do that in your implementation of performDragOperation:
. Something like:
- (BOOL)performDragOperation:(id < NSDraggingInfo >)sender {
NSArray *draggedFilenames = [[sender draggingPasteboard] propertyListForType:NSFilenamesPboardType];
if ([[[draggedFilenames objectAtIndex:0] pathExtension] isEqual:@"abc"])
return YES;
else
return NO;
}
精彩评论