Accessing resources in the package of an application created with xcode/cocoa

Posted by Michael Minerva on Stack Overflow See other posts from Stack Overflow or by Michael Minerva
Published on 2010-04-01T18:30:21Z Indexed on 2010/04/01 18:33 UTC
Read the original article Hit count: 322

Filed under:
|
|

I am trying to make a simple that needs to create an NSImage and I want to put the .png file in the resources of my package contents. I added the .png file to my resources directory in Xcode and when I create the applicaiton the .png file shows up in my resources inside package contents but I am havhing trouble figuring out how to reference file here is what I tried:

[image initWithContentsOfFile:@"resources/draw-button.png"];

I figured that my package contents would be my current directory so I thought this would work, but it does. How do I reference my resources directory?

© Stack Overflow or respective owner

Related posts about xcode

Related posts about cocoa