• 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: NSTextView and NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView and NSMutableArray


  • Subject: Re: NSTextView and NSMutableArray
  • From: j o a r <email@hidden>
  • Date: Tue, 20 May 2003 13:33:50 +0200

On Tuesday, May 20, 2003, at 12:48 Europe/Stockholm, Peter Karlsson wrote:

I can't figure out how to store a NSTextView to a NSMutableArray and get it back from the NSMutableArray to the NSTextView again. Can someone point me in the right direction please?

You mean "...how to store [the contents of] a NSTextView..." right? Something like this:

// Text view with some text
[myTextView setString: @"any string"];

// Store the string to an array
NSMutableArray *arr = [NSMutableArray arrayWithObject: [myTextView string]];

// Something happens to the text in the text view
[myTextView setString: @"some other string"];

// Restore text from array to text view
[myTextView setString: [arr objectAtIndex: 0]];

If you want to store the formatted string, and not just the series of characters, use [[[myTextView textStorage] copy] autorelease] instead of [myTextView string], or something similar.

j o a r
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >NSTextView and NSMutableArray (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Re: the art of #includes
  • Next by Date: NSRectFill not supporting compositing?????
  • Previous by thread: NSTextView and NSMutableArray
  • Next by thread: PPPoE marked but not active
  • Index(es):
    • Date
    • Thread