Re: How to Save & Restore the Contents of NSTextView.
Re: How to Save & Restore the Contents of NSTextView.
- Subject: Re: How to Save & Restore the Contents of NSTextView.
- From: Philip Dow <email@hidden>
- Date: Mon, 19 Dec 2005 11:23:05 +0100
Hi Janakiram,
If you are adding your own, custom attributes to the textview, ie
those not defined by nsattributedstring, then you should probably use
an archiver to save the attributed string associated with your text
view. This is surprisingly simple, as a textstorage is a subclass of
attributedstring. Read more about archiving here:
http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/
index.html#//apple_ref/doc/uid/10000047i
If you do not need to worry about custom attributes, just grab the
textview's rich text representation using nstext's RTFDFromRange: or
writeRTFDToFile:atomically: Then, to restore the saved data, use
replaceCharactersInRange:withRTFD: or readRTFDFromFile: This is also
very easy, as an nstextview is a subclass of nstext.
-Phil
On Dec 19, 2005, at 10:42 AM, Janakiram wrote:
Hi,
I am using NSTextview for accept user-input.I am allowing the user
to enter the strings with different fonts , colors ( by providing
font,color panels). Now when i tried to save the textstorage ( of
textview layout manger )along with my app data , it is saving . But
when the application relaunches then it is shows some exceptions
while settings the text view layout manager storage. Please give
your suggestions on how to store & retreive the nstextview
(attributed string) contents.
-JanakiRam._______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden