adding resources in xcode with folders

Discussion in 'Mac Programming' started by kamo, Mar 22, 2008.

  1. macrumors member

    Joined:
    Mar 21, 2008
    #1
    Hello,

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

    Code:
    [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
     
  2. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Just use Add folder or group or whatever it is called and do it yourself.
     
  3. macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #3
    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
     
  4. thread starter macrumors member

    Joined:
    Mar 21, 2008
    #4
    thanks, that worked perfectly!
     
  5. macrumors member

    Joined:
    Feb 25, 2008
    #5
    i have tried both ways but nothing is copied to my iphone simulator, any help would be nice!
     

Share This Page