Using ScreenSaverDefaults with NSUserDefaultsController
Using ScreenSaverDefaults with NSUserDefaultsController
- Subject: Using ScreenSaverDefaults with NSUserDefaultsController
- From: Craig Hockenberry <email@hidden>
- Date: Fri, 18 Feb 2005 18:53:08 -0800
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
_______________________________________________
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