| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
_______________________________________________
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
| References: | |
| >Binding NSTableColumn.textColor to Two Things; (From: Matt Budd (Madentec) <email@hidden>) | |
| >Re: Binding NSTableColumn.textColor to Two Things; (From: mmalcolm crawford <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.