Bindings & User Defaults?

Discussion in 'iOS Programming' started by ArtOfWarfare, Apr 19, 2012.

  1. ArtOfWarfare, Apr 19, 2012
    Last edited: Apr 19, 2012

    ArtOfWarfare macrumors G3


    Nov 26, 2007
    Well, I just learned about the Bindings tab in Xcode. Kind of amazed I've never noticed it before. A lot of time writing noodley code could have been saved.

    In any event, I'd like to store some bound values in standard user defaults. I can imagine ways of writing code to do it, but I feel like there has to be something easier I can do using just the interface builder portion of Xcode.

    I see that there's an object called the "Shared User Defaults Controller" (and in fact, it's already in my Objects list without me having added it... I suspect it was automatically added when I set my first binding.) Clicking on it and going over to the Bindings tab I see... nothing. Literally nothing. It neither says "Not Applicable" like many other tabs nor lists options for what I can bind with it. So... how do I bind the state of an on-off switch to the user defaults (graphically - without code)?

    Oh, and this on-off switch is already bound with an @property. I'd like the property to also be bound with the user defaults.

    Edit: Okay... I see that I can choose to bind to the "Shared User Defaults" controller... but then how do I bind both / either of them to the @property at the same time?

    2X Edit: And now I know why I've never seen this option before... I only just started programming in Cocoa, which is where the option is... it's not actually in Cocoa touch. I suppose this thread aught to be moved over to the general programming area, given it doesn't apply to iOS very well.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008

Share This Page