Bindings not updated. Can't see what's wrong
This is my setup:
In my app delegate, I register my defaults.
In my preferences nib I have bound a checkbox to the shared user defaults with controller key values
and model key path test
.
In my custom object I have a property BOOL test
and in its init
method I call
[self bind: @"test" toObject: [NSUserDefaults standardUserDefaults] withKeyPath: @"values.test" options: nil];
In the same object I have the @property NSString *testString
and I also have a + (NSSet *)keyPathsForValuesAffectingTestString
which returns an NSSet with @"test"
.
I subclassed - (NSString *)testString
but it never gets called.
Am I missing something?
T开发者_JAVA技巧hanks in advance.
Found a solution: if I use [NSUserDefaultsController sharedUserDefaultsController]
instead of [NSUserDefaults standardUserDefaults]
it works.
精彩评论