userDefaultsDidChange is causing a loop with dependent checkbox values
userDefaultsDidChange is causing a loop with dependent checkbox values
- Subject: userDefaultsDidChange is causing a loop with dependent checkbox values
- From: Adam Gerson <email@hidden>
- Date: Sat, 12 Jun 2010 14:25:30 -0400
I have set up some NSUserDefaults and used bindings to bind them to
some checkboxes and radiobuttons in my nib. I want the act of checking
some of the checkboxes to uncheck or check other checkboxes. I did
this by registering for a NSUserDefaultsDidChangeNotification.
Then inside userDefaultsDidChange() I have some if statements that
check the current value of checkbox A and set checkbox B to what I
want it to be. However the problem I am having is that
[checkboxB setState:0] only changes the value on the screen but does
not update the defaults saved value in the file and changing the
default directly with [defaults setBool:NO forKey:@"checkboxB"] causes
a loop by calling userDefaultsDidChange() again.
What is the right way to achieve this kind of one checkbox dependent
on anothers value with NSUserDefaults and bindings?
Thanks,
Adam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden