Skip navigation.
 
mlUsing ScreenSaverDefaults with NSUserDefaultsController
FROM : Craig Hockenberry
DATE : Sat Feb 19 03:53:08 2005

I am working on a plug-in that uses ScreenSaverDefaults instead of
NSUserDefaults (so it doesnąt put it's preferences in the application's
domain.)

I'd like to use bindings to manage these user defaults -- but for the life
of me I can't figure out how to do it.

I am loading an instance of NSUserDefaultsController from the NIB file --
but donąt see anyway to get it to use something other than [NSUserDefaults
standardUserDefaults].

I've tried creating my own subclass and overriding the defaults: method to
return an instance of ScreenSaverDefaults, but that doesn't seem to have any
effect. (Interestingly, defaults: is invoked before awakeFromNib: so it
seems we need an instance before the NIB is finished loading.)

The only success I've had is by creating my own instance with
[[NSUserDefaultsController alloc] initWithDefaults:myDefaults
initialValues:myInitialValues]. But if I do this, I donąt have anything to
bind against in Interface Builder -- and doing my own
bind:toObject:withKeyPath:options defeats the purpose of using bindings in
the first place.

Any ideas or suggestions would be most appreciated. At this point my only
option appears to be implementing an NSObjectController with my own
preference model -- that's a whole lot of code I'd rather not write...

-ch

Related mailsAuthorDate
mlUsing ScreenSaverDefaults with NSUserDefaultsController Craig Hockenberry Feb 19, 03:53
mlRe: Using ScreenSaverDefaults with NSUserDefaultsController leenoori Dec 16, 17:27