Problem with NSColor since 10.2
Problem with NSColor since 10.2
- Subject: Problem with NSColor since 10.2
- From: Frank Blome <email@hidden>
- Date: Wed, 28 Aug 2002 09:28:10 +0200
Another question on the new DevTools from Jaguar (they really drive me
crazy). These part of the source code has worked fine before I had
upgraded:
I defined in my .h:
...
NSData *allowColor;
...
-------------------
// While loading the Preferences I do:
...
allowColor = [defaults objectForKey: @"AllowColor"];
if (allowColor == nil)
allowColor = [NSArchiver archivedDataWithRootObject:[NSColor
blueColor]];
[colorWellAllow setColor:[NSUnarchiver
unarchiveObjectWith
Data:allowColor]];
...
-------------------
// When I'm saving the color, I do:
- (IBAction)setAllowColor:(id)sender
{
NSColor *color = [sender color];
allowColor = [NSArchiver archivedDataWithRootObject:color];
[[NSUserDefaults standardUserDefaults] setObject:allowColor forKey:
@"AllowColor"];
[self loadPreferences];
}
-------------------
// Finally while displaying the rows in a NSTableView:
- (void)tableView:(NSTableView*)aTableView
willDisplayCell:(id)cell
forTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex
{
...
else if ([[cell stringValue] hasPrefix:@"ALLOW"])
{
[cell setTextColor: [NSUnarchiver unarchiveObjectWithData:
allowColor]];
}
...
}
Anyone knows whats goin' on here? Have I done a general mistake, or is
the code OK?
Thank you for helping me out of the swamp,
Frank
_______________________________________________
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.