• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do you set the text in an NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >How do you set the text in an NSTextView? (From: G S <email@hidden>)
 >Re: How do you set the text in an NSTextView? (From: Bill Hernandez <email@hidden>)
 >Re: How do you set the text in an NSTextView? (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: NSPopupButtons work, but not in hierarchical mode, what am I missing here ?
  • Next by Date: Re: Cocoa/Objective-C flat name space problems
  • Previous by thread: Re: How do you set the text in an NSTextView?
  • Next by thread: More general question related to : How do you set the text in an NSTextView?
  • Index(es):
    • Date
    • Thread