Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSColor/NSColorWell saving help needed

NSColor/NSColorWell saving help needed
Thread Tools
Syphor
Junior Member
Join Date: Jul 2002
Location: Australia
Status: Offline
Reply With Quote
Jul 22, 2003, 06:43 AM
 
I get the above error with the code:



Code:
[prefDefaults setObject:[[chatColorIB color] colorNameComponent] forKey:@"ChatColorName"];
     
Syphor  (op)
Junior Member
Join Date: Jul 2002
Location: Australia
Status: Offline
Reply With Quote
Jul 22, 2003, 06:53 AM
 
All i basically want to do it get the colorwell's color and save it then load it
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 22, 2003, 06:57 AM
 
It looks pretty self-explanatory to me. This is not a named color, it's a plain RGB color; it doesn't have a color name component. If you want to save it, save its RGB values.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
disco_stu
Junior Member
Join Date: Jun 2002
Location: Springfield
Status: Offline
Reply With Quote
Jul 22, 2003, 07:56 AM
 
To save the color:

[[userDefaults setObject:[NSArchiver archivedDataWithRootObject:[chatColorIB color]] forKey:@"ChatColorName"];

To read the color:

[chatColorIB setColor:[NSUnarchiver unarchiveObjectWithData:[userDefaults objectForKey:@"ChatColorName"]]];

A default's value can be only property list objects: NSData, NSString, NSNumber, NSDate, NSArray, or NSDictionary. So any other object must be converted to NSData.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:44 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,