Re: appending a string to an NSTextView
Re: appending a string to an NSTextView
- Subject: Re: appending a string to an NSTextView
- From: Paul Lynch <email@hidden>
- Date: Tue, 30 May 2006 10:09:31 +0100
On 29 May 2006, at 14:48, Roland Silver wrote:
What's the simplest way to append a given NSString to the end of
the text in a NSTextView?
I didn't see a response to this, which probably means I am losing
emails from the list. On the unlikely off-chance that it really
hasn't been answered:
There is no immediately obvious way to append text to an NSTextView;
it inherits a setString: method from NSText, and has an insertText:
method (which is for totally different uses). Also, NSString may not
be the best content representation to use; NSTextView can also return
an NSAttributedString using textStorage, which is probably the best
rich content within the text system for general manipulation
(although you can also use RTF/RTFD). NSString/RTF/RTFD can be
manipulated using the NSText methods beginning
replaceCharactersInRange: (but not NSAttributedString).
An example of using the textStorage approach with an NSString is
given in the Text System Overview, at: file:///Developer/ADC%
20Reference Library/documentation/Cocoa/Conceptual/TextArchitecture/
Tasks/SimpleTasks.html
If you are using an NSAttributedString, then you can use the
appendAttributedString: method of this class, as NSTextStorage is a
subclass.
Paul
_______________________________________________
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