• 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
Re: Getting the desktop background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the desktop background


  • Subject: Re: Getting the desktop background
  • From: Todd Yandell <email@hidden>
  • Date: Mon, 8 Nov 2004 19:28:48 -0600

Hi,

The user's current desktop image is stored in the desktop preference panel's defaults file. This is found at ~/Library/Preferences/com.apple.desktop.plist. The following code will return an NSImage already init'ed with the user's desktop image:

<x-tad-bigger>- (NSImage *)desktopImage
{
NSString *fileName;
fileName = [</x-tad-bigger><x-tad-bigger>@"~/Library/Preferences/com.apple.desktop.plist"</x-tad-bigger><x-tad-bigger>
stringByExpandingTildeInPath];


</x-tad-bigger><x-tad-bigger>return</x-tad-bigger><x-tad-bigger> [[[NSImage alloc] initWithContentsOfFile:[[[[NSDictionary
dictionaryWithContentsOfFile: fileName]
objectForKey:</x-tad-bigger><x-tad-bigger>@"Background"</x-tad-bigger><x-tad-bigger>] objectForKey:</x-tad-bigger><x-tad-bigger>@"default"</x-tad-bigger><x-tad-bigger>]
objectForKey:</x-tad-bigger><x-tad-bigger>@"ImageFilePath"</x-tad-bigger><x-tad-bigger>]] autorelease];
}

</x-tad-bigger>
 _______________________________________________
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: Getting the desktop background
      • From: Andreas Mayer <email@hidden>
References: 
 >Getting the desktop background (From: Austin Sarner <email@hidden>)

  • Prev by Date: Re: Overriding -copyWithZone: the right way
  • Next by Date: Re: Newbie question on saving data
  • Previous by thread: Getting the desktop background
  • Next by thread: Re: Getting the desktop background
  • Index(es):
    • Date
    • Thread