• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Binding to Desktop Image Path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding to Desktop Image Path?


  • Subject: Binding to Desktop Image Path?
  • From: "Christopher Hickman" <email@hidden>
  • Date: Tue, 9 May 2006 13:57:44 -0400

Can this code be replaced with a binding with NSUserDefaultsController?

/* begin code snippet */
NSUserDefaults *uDef = [NSUserDefaults standardUserDefaults];
NSDictionary *uDefDict = [[[uDef
persistentDomainForName:@"com.apple.desktop"] objectForKey:@"Background"]
objectForKey:@"default"];
NSString *imagePath = [uDefDict objectForKey:@"ImageFilePath"];
/* end code snippet */

I tried binding the value of an NSTextField in my nib to the
NSUserDefaultsController, using:

Bind to: Shared User Defaults
Controller Key: values
Model Key Path: com.apple.com.Background.default.ImageFilePath

The NSTextField ends up nil.  I still don't fully understand the controller
key and model key stuff for bindings, so I'm probably using it wrong.  How
should I reference this?  I know I can't pull this string directly from the
command line with defaults read, since I can't go deeper than the dictionary
in the com.apple.desktop domain with the key Background.

Topher

 _______________________________________________
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

  • Follow-Ups:
    • RE: Binding to Desktop Image Path?
      • From: "Christopher Hickman" <email@hidden>
  • Prev by Date: Making a panel float over another application
  • Next by Date: Re: First click when activated
  • Previous by thread: Re: Making a panel float over another application
  • Next by thread: RE: Binding to Desktop Image Path?
  • Index(es):
    • Date
    • Thread