【发布时间】:2013-05-21 21:33:22
【问题描述】:
如果您将选定的文本拖放到文件夹中,您将获得一个扩展名为 textClipping 的文件。 TextEdit 的文档窗口接受文本选择。许多应用程序确实接受 textClipping。您如何在 NSImageView 下拉框中接收文本选择? performDragOperation 的常规操作似乎不接受文本选择。
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
NSPasteboard *pboard = [sender draggingPasteboard];
NSArray *urls;
if ([[pboard types] containsObject:NSURLPboardType]) {
urls = [pboard readObjectsForClasses:@[[NSURL class]] options:nil];
}
AppDelegate *appDelegate = (AppDelegate *)[NSApp delegate];
...
...
return YES;
}
这些代码行让我可以接受文件,但不能接受 textClipping。接受 textClipping 的秘诀是什么?也许,你不能用 NSImageView 接受它?使用“Objective-C textClipping”运行搜索没有任何结果。
感谢您的建议。
【问题讨论】:
标签: objective-c macos text osx-mountain-lion nsimageview