Re: use of NSUnarchiver
Re: use of NSUnarchiver
- Subject: Re: use of NSUnarchiver
- From: Douglas Davidson <email@hidden>
- Date: Wed, 30 Jan 2002 10:03:42 -0800
On Tuesday, January 29, 2002, at 06:02 PM, Darin Duphorne wrote:
I have NSAttributedString content in a NSTextView that I want to move
to a different NSTextView. I am trying to use an NSArchiver and
NSUnarchiver to achieve this move via an NSData. It doesn't work.
Here's what I'm trying to do:
If the two textviews are in the same app, you can simply move the
content as an attributed string. If you are trying to store this in
some external format, you should use RTF or RTFD; this is what the
pasteboard uses for copy and paste of rich text. Use RTFD if there may
be attachments in your text. To get an NSData, use
RTF/RTFDFromRange:documentAttributes: to write and
initWithRTF/RTFD:documentAttributes: to read. To write out a .rtf or
.rtfd is similar; see the sources to TextEdit for an example.
Douglas Davidson