programmatically set background image of folder

Discussion in 'Mac Programming' started by ZacharyDenison, Apr 7, 2008.

  1. macrumors newbie

    Joined:
    Feb 27, 2008
    #1
    Hello,

    I am trying to make a small drag-n-drop utility with Xcode in Objective-C / Cocoa to create dmg files, I am not sure how to programmatically set the background image of a folder. Does anyone know the name of the class that handles this?

    Thank you.

    Zach.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    There is not a Cocoa interface to this. Probably the easiest way is to tell the Finder to do it via Applescript.
     
  3. macrumors 6502a

    yeroen

    Joined:
    Mar 8, 2007
    Location:
    Cambridge, MA
    #3
    You'll have to manipulate the Folder image, which typically (I believe) is stored in a resource fork. I not 100% about Cocoa, but other frameworks (like Qt) allow you to manipulate images by applying transparency masks. You could layer the new image onto the folder image, flatten, then write back to the file.

    There's probably a simpler way of doing this, but I don't know what that might be.
     
  4. macrumors member

    Joined:
    Jan 31, 2005
    Location:
    Sweden
    #4

Share This Page