Copy NSAttributedString to pasteboard
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-04-05T21:50:07Z
Indexed on
2010/04/05
21:53 UTC
Read the original article
Hit count: 295
Brand new to Cocoa and I'm trying to figure out how to copy an NSAttributedString to the pasteboard. I've looked in the docs and not sure if I'm supposed to use a NSPasteboardItem or not.
Here's what I have to copy a regular NSString:
NSPasteboard *pb = [NSPasteboard generalPasteboard];
NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil];
[pb declareTypes:types owner:self];
[pb setString:@"asdfasdf" forType:NSStringPboardType];
How do I set a NSAttributedString?
Thanks
© Stack Overflow or respective owner