• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
userDefaultsDidChange is causing a loop with dependent checkbox values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: userDefaultsDidChange is causing a loop with dependent checkbox values
      • From: Reinhard Segeler <email@hidden>
    • Re: userDefaultsDidChange is causing a loop with dependent checkbox values
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: Type of NSData contents
  • Next by Date: Re: Type of NSData contents
  • Previous by thread: Re: Type of NSData contents
  • Next by thread: Re: userDefaultsDidChange is causing a loop with dependent checkbox values
  • Index(es):
    • Date
    • Thread