Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSAttributedString saved into NSUserDefaults
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAttributedString saved into NSUserDefaults



on 05.4.1 6:20 AM, Steve Sheets at email@hidden wrote:
> How can NSAttributedString be saved/converted in the User Defaults (ie.
> Preferences)?

I think following is the simplest code for you.

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

//Saving:
[defaults setObject:[NSArchiver archivedDataWithRootObject:attrString]
forKey:YourKey];

//Loading:
attrString =[NSUnarchiver unarchiveObjectWithData:[defaults
objectForKey:YourKey]];

Satoshi
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802


 _______________________________________________
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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.