• 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
Re: userDefaultsDidChange is causing a loop with dependent checkbox values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: userDefaultsDidChange is causing a loop with dependent checkbox values


  • Subject: Re: userDefaultsDidChange is causing a loop with dependent checkbox values
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 12 Jun 2010 23:28:48 -0700

On 2010 Jun 12, at 11:25, Adam Gerson wrote:

> 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

Maybe the change is being deferred until later.  Tried -[NSUserDefaults synchronize]?

> 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.

Although I'm not saying it can't work, that doesn't seem very elegant.

> What is the right way to achieve this kind of one checkbox dependent
> on anothers value with NSUserDefaults and bindings?

I believe that if you need something more complicated than can be directly done with bindings (such as enabling checkbox B if checkbox A is checked), then a more conventional approach would be to write a little controller class and interpose it between your view and NSUserDefaults.  I seem to recall that NSUserDefaults has some documented but unexpected behaviors with bindings, and it's best not to get too innovative in this area.

_______________________________________________

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

References: 
 >userDefaultsDidChange is causing a loop with dependent checkbox values (From: Adam Gerson <email@hidden>)

  • Prev by Date: Re: Interference of a variable name with Interface Builder
  • Next by Date: Re: userDefaultsDidChange is causing a loop with dependent checkbox values
  • Previous by thread: userDefaultsDidChange is causing a loop with dependent checkbox values
  • Next by thread: Re: userDefaultsDidChange is causing a loop with dependent checkbox values
  • Index(es):
    • Date
    • Thread