• 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: Storing NSString with attributes + RTF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing NSString with attributes + RTF


  • Subject: Re: Storing NSString with attributes + RTF
  • From: jgo <email@hidden>
  • Date: Tue, 4 Dec 2001 19:34:59 -0800

> Ali Ozer wrote:
>> On Sunday, 2001 December 2 at 23:58, Ivan Myrvold wrote:
>>> On sxndag, 2001 desember 2 at 21:38 , Brendan Younger wrote:
>>> NSTextStorage inherits from NSMutableAttributedString. Therefore you
>>> can simply call -textStorage and get an NSMutableAttributed string to
>>> do whatever you want with.
>>>
>> OK, so whenever I want to store away the attributed text from
>> myTextView , I simply do a:
>> NSMutableAttributedString *myAttributedString;
>> myAttributedString = [[myTextView textStorage] copy];
>>
>> But what should I do when I want the myAttributedString back into
>> myTextView?
>
> [[textView textStorage] setAttributedString: myAttributedString]
>
> should do it. As Brendan said, NSTextStorage inherits from
> NSMutableAttributedString, which inherits from NSAttributedString.
> The API for these two classes are in two places:
>
> <Foundation/NSAttributedString.h>...
> <AppKit/NSAttributedString.h>...

> BTW, another way to make attributed strings persistent is to save them
> off as RTF or RTFD (the latter if you have graphics or attachments in
> your text). This is good for saving your attributed strings in files,
> databases, etc. This will not save away your custom attributes though.

Ahh, is there a recommended way to add support for other RTF tags/
attributes? Specific methods to provide in a particular way?

John G. Otto, Eagle Scout, Knight, Cybernetic Praxeologist
Existence, Consciousness, Identity, Life, Liberty, Property, Privacy, Justice


References: 
 >Re: Storing NSString with attributes (From: Ivan Myrvold <email@hidden>)
 >Re: Storing NSString with attributes (From: Ali Ozer <email@hidden>)

  • Prev by Date: Re: Fading a control
  • Next by Date: Re: Question
  • Previous by thread: Re: Storing NSString with attributes
  • Next by thread: [ANN] XRay 1.0b6
  • Index(es):
    • Date
    • Thread