Re: How much does NSObject's bind:toObject:withKeyPath:options: do?
Re: How much does NSObject's bind:toObject:withKeyPath:options: do?
- Subject: Re: How much does NSObject's bind:toObject:withKeyPath:options: do?
- From: Mailing list subscriptions <email@hidden>
- Date: Thu, 21 Sep 2006 18:04:14 +0200
El 21/09/2006, a las 17:23, R. Matthew Emerson escribió:
On Sep 21, 2006, at 6:35 AM, Mailing list subscriptions wrote:
Background info:
- my class is a controller class; not a model or a view
- some aspects of the behaviour of the controller should change
according to user preferences
- I'd therefore like to bind a couple of instance variables in the
controller to the corresponding values in the NSUserDefaults,
mediated via NSUserDefaultsController
I don't think Cocoa Bindings is the right tool here.
In the case you describe, in your custom controller, I would just
register for NSUserDefaultsDidChangeNotifiction and get the updated
defaults upon receipt of the notification. (Presumably this is
what you meant by "do it manually.")
I'm not sure if this will do exactly what I want... maybe it will...
The docs say that that notification gets sent "the first time after a
synchronize when a change is made to defaults in a persistent domain".
Given that the user may be manipulating the preferences (via controls
bound to the shared NSUserDefaultsController), how do I know when a
synchronize is performed? Does NSUserDefaultsController perform a
synchronize after every single change? or just periodically? If the
latter, then I could find that I'm getting out of sync with what the
user thinks the preferences are.
Isn't this what Cocoa Bindings is for? To keep things in sync built
on top of Key-Value observing, rather than using older mechanism like
notifications and notification centers?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden