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: Bill Hernandez <email@hidden>
- Date: Fri, 7 May 2010 12:02:39 -0500
On May 7, 2010, at 11:49 AM, Douglas Davidson wrote:
> 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
Douglas,
Great reply, thank you....
I noticed that as I had been learning this stuff, and creating small projects, in some places I had used {getter, setter} = {string, setString}
[textView setString:@"Welcome"];
NSString *myString = [textView string];
but I noticed I had used this at one point, and thought it was acceptable ?
[textView insertText:myString];
Thank you so much for the great clarification ...
Best,
Bill Hernandez
Plano, Texas_______________________________________________
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