Re: Altering the behavior of NSUserDefaults
Re: Altering the behavior of NSUserDefaults
- Subject: Re: Altering the behavior of NSUserDefaults
- From: Matt Neuburg <email@hidden>
- Date: Sat, 07 Oct 2006 08:24:00 -0700
- Thread-topic: Altering the behavior of NSUserDefaults
On Fri, 06 Oct 2006 17:07:00 -0700, Matt Neuburg <email@hidden> said:
>On Fri, 6 Oct 2006 16:41:15 -0700, Ron Aldrich <email@hidden> said:
>>Folks,
>>
>>I've run into a bit of a problem, which I'm unsure how to address.
>>
>>I'm implementing a preferences panel in my application, with the view
>>objects bound to an NSUserDefaultsController.
>>
>>Many of the bindings need to be handled programatically - for
>>instance, the "enabled" bindings depend on the value of some of the
>>other settings.
>>
>>The problem is, I can't figure out how, or where, I'm supposed to
>>instantiate my subclass of NSUserDefaults (or of
>>NSUserDefaultsController, for that matter).
>>
>>I tried setting the NSUserDefaultsController's custom class attribute
>>in Interface Builder, but it seems to be ignored, when creating
>>controllers (Is this a bug in IB? or am I not supposed to be
>>overriding the behavior of controllers?)
>>
>>I also tried setting a delegate for NSUserDefaults, but that doesn't
>>appear to be supported.
>>
>>Any suggestions?
>
>What I would do is to bind stuff in the preferences panel to a custom class,
>and bind the stuff in the custom class to the NSUserDefaults. That way,
>there is no need for a subclass of NSUserDefaults; the functionality you're
>looking for would be handled by the intermediate class. Binding "chains" of
>this sort are quite common in my apps, because I often have three (or more)
>things to keep in synch. m.
I should add, though, that if the only problem you're really having is that
'the "enabled" bindings depend on the value of some of the other settings,'
that is logic that could easily be handled by a value transform. So then you
could just go on binding to the vanilla NSUserDefaultsController in the
normal way. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden