开发者

Custom object on NSPasteboard

I am using NSPasteboardWriting protocol for writing custom object on NSPasteboard. How to create UTI for c开发者_运维问答ustom object?

- (NSArray *)writableTypesForPasteboard:(NSPasteboard *)pasteboard {

static NSArray *writableTypes = nil;
if (!writableTypes) 
{ 
    writableTypes = [[NSArray alloc] initWithObjects:[FileSystemItem class], nil]; 
} 
NSLog(@"writable%@", writableTypes);
return writableTypes;

}

- (id)pasteboardPropertyListForType:(NSString *)type {
NSLog(@"type = %@", type);
return type;
}

FileSystemItem is my custom class. Are the above two methods are correct?


You don't "create" a UTI. You just use the same one everywhere you need it.

The standard pasteboard UTI format is:

com.mycompany.myapp.mypasteboardtype
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜