• 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: relation between NSTextStorage and appended NSAttributedString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: relation between NSTextStorage and appended NSAttributedString


  • Subject: Re: relation between NSTextStorage and appended NSAttributedString
  • From: Dietrich Epp <email@hidden>
  • Date: Sat, 5 Oct 2002 23:13:00 -0700

On Saturday, October 5, 2002, at 05:48 , Arthur Clemens wrote:

I am trying to do something but it is not so clear to me:

In a NSTextView I have a NSMutableAttributedString object that I append
to the text view's NSTextStorage.
But if I change the NSMutableAttributedString object, this change is
not reflected in the NSTextStorage. And also the other way around: when
I type in the NSTextView, the NSMutableAttributedString object is not
updated.

So it seems that [NSMutableAttributedString appendAttributedString]
does not keep a pointer reference but makes a copy of the sent
attributedString, and then forgets about it.

Um, that's the way its supposed to work. It just makes sense that way.

The method description in the docs points says it actually:

appendAttributedString:
- (void)appendAttributedString:(NSAttributedString *)attributedString

Adds the characters and attributes of attributedString to the end of
the receiver.

That's exactly what it does.

In my program I *would* like to have a direct relation NSTextStorage
<----> pointer to NSMutableAttributedString object.
This is somewhat like the relation between a NSTableView and its data
source, I guess.

Would it be unnatural to follow this path?

Yes.

The NSTextStorage is basically an NSMutableAttributedString itself -- in fact, it is a subclass. Unlike in tables, where a view is connected to a user-supplied data source which could contain a wide variety of data, text is only one kind of data and is rather easy to deal with in a one-size-fits-all class.
_______________________________________________
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: 
 >relation between NSTextStorage and appended NSAttributedString (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Re: Bochs - Free PC emulator
  • Next by Date: Re: Bochs - Free PC emulator
  • Previous by thread: relation between NSTextStorage and appended NSAttributedString
  • Next by thread: Re: relation between NSTextStorage and appended NSAttributedString
  • Index(es):
    • Date
    • Thread