PDA

View Full Version : adding resources in xcode with folders




kamo
Mar 22, 2008, 10:09 AM
Hello,

I have a a bunch of resources organized in folders. Eg:


[Cars]
[Red]
front.jpg
side.jpg
[Green]
front.jpg
side.jpg

[] are folders. I'd like to have xcode copy this folder structure into he Resources of the project.

When I add the [Cars] folder as an existing file to the Resources, xcode copies the jpegs to the project root. When it builds the target, it copies the jpegs to the build root instead of the Resources folder. Also, the folder structure is not recreated. So obviously I'm doing something wrong....

How can I add this folder structure to my resources?

Thanks,
kamo



Cromulent
Mar 22, 2008, 10:16 AM
Just use Add folder or group or whatever it is called and do it yourself.

Sayer
Mar 22, 2008, 02:54 PM
Add a new "Copy Files" Build Phase to the target you are building. Add a new build phase using the Build menu in Xcode.

Then drag and drop the Resource folder or files in the project file list on the left side of the window to the "Copy Files" build phase.

To set which folder the files are copied to you select the "Copy Files" build phase in the target list and type Command-I (Get Info). In the "Destination" popup menu you can select which sub-folder the files will be copied to.

Sample screenshot: http://att.macrumors.com/attachment.php?attachmentid=107711&d=1205431384

kamo
Mar 22, 2008, 04:54 PM
thanks, that worked perfectly!

ramzez
Aug 27, 2008, 05:42 PM
i have tried both ways but nothing is copied to my iphone simulator, any help would be nice!