Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding NSTableColumn.textColor to Two Things;



On Jul 30, 2004, at 2:44 PM, Matt Budd (Madentec) wrote:

The problem is that a change on the preference panel only ripples through to the column of the table view when I change the value in the table view (and it then tries to reapply the transformer which gives the correct dynamic NSColor). I would like a change to ripple through to the text color immediately upon change in the preference panel.

Either register for preferences change notifications, or (probably better), observe user defaults:


- (void)awakeFromNib
{
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeyPath:@"values.favoriteColor" // whatever key
options:0
context:favColorContext];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == favColorContext)
{
[tableview reloadData];
}
// If appropriate: [super observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context];
}


I should probably update the Preferences example to follow this pattern...

mmalc
_______________________________________________
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.


References: 
 >Binding NSTableColumn.textColor to Two Things; (From: Matt Budd (Madentec) <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.