Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ZacharyDenison

macrumors newbie
Original poster
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.
 
There is not a Cocoa interface to this. Probably the easiest way is to tell the Finder to do it via Applescript.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.