• 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: appending a string to an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: appending a string to an NSTextView


  • Subject: Re: appending a string to an NSTextView
  • From: Lon Giese <email@hidden>
  • Date: Tue, 30 May 2006 02:29:56 -0700

This has worked for me... when all I want is the advance scrolling capabilities of NSTextView but don't want to bother with NSAttributedStrings

[[aTextView textStorage] appendAttributedString:[[[NSAttributedString alloc] initWithString:@"ANY NSString you want"] autorelease]];



WooHoo the ultimate Mac App for 'The Sims 2' power users.
http://www.modthesims2.com/showthread.php?p=1239629
On May 30, 2006, at 2:09 AM, Paul Lynch wrote:


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 Reference 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:
email@hidden


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


  • Follow-Ups:
    • Re: appending a string to an NSTextView
      • From: "Michael Ash" <email@hidden>
References: 
 >appending a string to an NSTextView (From: Roland Silver <email@hidden>)
 >Re: appending a string to an NSTextView (From: Paul Lynch <email@hidden>)

  • Prev by Date: Re: Image cache: Where is it and how do I refresh it?
  • Next by Date: Re: Image cache: Where is it and how do I refresh it?
  • Previous by thread: Re: appending a string to an NSTextView
  • Next by thread: Re: appending a string to an NSTextView
  • Index(es):
    • Date
    • Thread