Re: How do you set the text in an NSTextView?
Re: How do you set the text in an NSTextView?
- Subject: Re: How do you set the text in an NSTextView?
- From: Douglas Davidson <email@hidden>
- Date: Fri, 7 May 2010 09:49:23 -0700
On May 7, 2010, at 9:41 AM, Bill Hernandez wrote:
> [textView insertText:myString];
You don't want to call insertText: for this. From the documentation: "This method is the entry point for inserting text typed by the user and is generally not suitable for other purposes. Programmatic modification of the text is best done by operating on the text storage directly. Because this method pertains to the actions of the user, the text view must be editable for the insertion to work."
The simplest way to set the entire contents is to call setString:. More detailed modifications are best done by operating on the text storage, which is a subclass of NSMutableAttributedString.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden