开发者

Bindings not updated. Can't see what's wrong

开发者 https://www.devze.com 2023-02-11 08:14 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消