registerDefaults Conflict with Bindings?
registerDefaults Conflict with Bindings?
- Subject: registerDefaults Conflict with Bindings?
- From: Seth Willits <email@hidden>
- Date: Fri, 6 May 2005 14:02:32 -0700
I have a slew of checkboxes and popups in my preferences window so I
figured it'd be a great candidate for using bindings. In 5 minutes I
was able to connect everything and it was working great except that
by default everything was unchecked and unselected, as I would expect
since there weren't and specified defaults.
So what I did was add a registerDefaults block to the code side of
things, something like:
NSMutableDictionary * defaults = [NSMutableDictionary
dictionaryWithCapacity:10];
[defaults setValue:[NSNumber numberWithBool:YES]
forKey:@"convertIndenting"];
[defaults setValue:[NSNumber numberWithBool:YES]
forKey:@"autoIndentAfterReturn"];
[defaults setValue:[NSNumber numberWithBool:YES]
forKey:@"commentsFollowIndent"];
[defaults setValue:[NSNumber numberWithBool:YES]
forKey:@"autocompleteBrackets"];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
Now, the weird thing is that if I run the app, first off none of the
checkboxes are checked. Second, if I check all four of them and then
restart the app, only two of them are checked. Which two is 100%
consistent too. I've recreated the bindings and the checkboxes
themselves numerous times, changed the binding names, cleaned and
rebuilt the project, restarted, deleted the existing preferences a
million times and nothing changes. It still only works for certain
checkboxes. The keys I use for the bindings' key path is exactly the
same as I use above.
I've read all I can find in the docs that mention register defaults
(which is one paragraph that doesn't really help much at all). I'm
not really sure why this is happening. The defaults are registered in
the + initialize method of the application's delegate class. I wasn't
sure that I had to do that but the docs suggest that it should work.
Any ideas?
--
Seth Willits
_______________________________________________
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