• 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: NSAttributedString saved into NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString saved into NSUserDefaults


  • Subject: Re: NSAttributedString saved into NSUserDefaults
  • From: John Brownlow <email@hidden>
  • Date: Thu, 31 Mar 2005 16:27:57 -0500

you encode it using -encodeWithCoder or whatever into NSData, and store the data

then when you retrieve it from the defaults you decode it

also works with fonts, colors etc.

or you can use the built in NSValueTransformer

(id) unarchiver = [NSValueTransformer NSUnarchiveFromDataValueTransformer];

NSData data = [unarchiver transformedValue: theString];

etc

[Disclaimer: typed into mail.app from memory]




On Mar 31, 2005, at 4:20 PM, Steve Sheets wrote:

How can NSAttributedString be saved/converted in the User Defaults (ie. Preferences)? Is there a way to convert NSAttributedString (ie. text containing fonts, font size, colors and other text attributes) into a NSString, and then saved into a NSAttributedString? And then later be able to read it out of the applications user defaults back into a NSAttributedString with the font information restored?

--
John Brownlow
Deep Fried Films, Inc

http://www.johnbrownlow.com
http://www.pinkheadedbug.com

_______________________________________________
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


References: 
 >NSAttributedString saved into NSUserDefaults (From: Steve Sheets <email@hidden>)

  • Prev by Date: NSAttributedString saved into NSUserDefaults
  • Next by Date: Re: NSAttributedString saved into NSUserDefaults
  • Previous by thread: NSAttributedString saved into NSUserDefaults
  • Next by thread: Re: NSAttributedString saved into NSUserDefaults
  • Index(es):
    • Date
    • Thread