我有一个 NSBroswer,其中包含一系列查找文本 blob 的条目。如果 blob 存在,则
- (BOOL)browser:canDragRowsWithIndexes:inColumn:withEvent:
返回 YES。
这调用
- (BOOL)browser:writeRowsWithIndexes:inColumn:toPasteboard:
在这里,我执行以下操作:
NSUInteger changeCount;
BOOL retBOOL = YES;
changeCount = [pasteboard clearContents];
changeCount = [pasteboard declareTypes:@[NSPasteboardTypeString, NSPasteboardTypeHTML]
owner:self];
didSet = [pasteboard setString:self.currentHTMLCode
forType:NSPasteboardTypeString];
retBOOL = retBOOL & didSet;
didSet = [pasteboard setString:[NSString stringWithFormat:@"<pre>%@</pre>", self.currentHTMLCode]
forType:NSPasteboardTypeHTML];
retBOOL = retBOOL & didSet;
现在出来的粘贴板的数据分析(带有retBOOL:是)是:
pasteboard: : <NSPasteboard: 0x101931870>
name: : Apple CFPasteboard drag
change count: : 77
types: : (
"public.utf8-plain-text",
NSStringPboardType,
"public.html",
"Apple HTML pasteboard type"
)
items: : (
"<NSPasteboardItem: 0x1005a5cb0>"
)
PBItem: : <NSPasteboardItem: 0x1005a5cb0>
PBType: : public.utf8-plain-text
String for type [public.utf8-plain-text] = 89958 characters
PBType: : public.html
String for type [public.html] = 89969 characters
retValue: YES
所以我的问题是,当我将它拖到 SimpleText 或 BBEdit 时,什么都没有。我没有看到目标文档的亮点。(注:我也有拖图例程,看到拖图了)
任何想法为什么我似乎正在填充粘贴板但它拒绝放入其他应用程序?