Alexander,
If you have a bunch of keys in your defaults, try only observing the
specific key. Like this...
- (void)awakeFromNib
{
//setup key observer here
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"AppleMeasurementUnits"
options:NSKeyValueObservingOptionNew
context:NULL];
}
//
------------------------------------------------------------------------------
// Do this when the observed keys change:
//
------------------------------------------------------------------------------
- (void) observeValueForKeyPath:(NSString *) keyPath ofObject:(id)
object
change:(NSDictionary *) change
context:(void *) context
{
//was one of the selectedView buttons pressed?
if([keyPath isEqual:@"AppleMeasurementUnits"])
{
//Stuff to do when AppleMeasurementUnits changes
}
}
All the best,
Steven Riggs
http://www.stevenriggs.com
NSUserDefaultsDidChangeNotification
On 09-Oct-08, at 5:51 PM, Alexander Shmelev wrote:
Hello,
My program UI depends on what measurement units are used.
How can I get notification when "AppleMeasurementUnits" have been
changed by "Preferences" application?
Best regards, Alexander.
_______________________________________________
Cocoa-dev mailing list ([EMAIL PROTECTED])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/[EMAIL PROTECTED]
This email sent to [EMAIL PROTECTED]
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]