PDA

View Full Version : NSUserDefaults, Bindings, NSPopup Button Question




mdeh
Aug 27, 2013, 11:47 PM
Hi all
I am looking for help with this, possibly am using the wrong approach. The setting is as follows.
1) I register a "Factory" default (in this case the index of an initial popUpButton (an NSNumber)) for a key.

2) In the xib, an NSArrayController's content binds to an NSArray.

3) In the Xib, the popUp Button's content Values binds to the "arrangedObjects" of the controller.

4) In the Xib, the popUP Button's selectedIndex binds to the Shared User defaults controller whose modelKeyPath is the key in (1) above.

All this works as expected. The initial popUP is the "Factory" value, and subsequent values of the popUPButton are the last value chosen before quitting.

Now...I would like to access the current value of the popUpButton. Prior to binding to the userDefaultsController, I had bound the button's selectedValue to a property in the controller.m file. Currently this is not possible, as binding the selectedIndex disables the selectedValue.
I am sure this is not a new problem, but what approach would those who work with bindings suggest.
(What I am after is once the user has selected a particular popupButton value, this be reflected in a model "property").
thanks in advance.